/* 
 * Command line: opannotate --source --assembly ./branch-prediction 
 * 
 * Interpretation of command line:
 * Output annotated assembly listing with samples
 * 
 * CPU: P4 / Xeon, speed 2593.62 MHz (estimated)
 * Counted BRANCH_RETIRED events (retired branches) with a unit mask of 0x08 (branch taken mispredicted) count 3000
 */
               :
               :/root/programy/branch-prediction:     file format elf32-i386
               :
               :Disassembly of section .init:
               :Disassembly of section .plt:
               :Disassembly of section .text:
               :
08048484 <main>: /* main total:     11 100.000 */
               :#include <stdio.h>
               :
               :int main(int argc, char **argv)
               : 8048484:	lea    0x4(%esp),%ecx
               : 8048488:	and    $0xfffffff0,%esp
               : 804848b:	pushl  -0x4(%ecx)
               : 804848e:	push   %ebp
               : 804848f:	mov    %esp,%ebp
               : 8048491:	push   %ebx
               : 8048492:	push   %ecx
               : 8048493:	sub    $0x30,%esp
               :{
               :  int count = 1000000000;
               : 8048496:	movl   $0x3b9aca00,-0x1c(%ebp)
               :  int i;
               :  
               :  int s = 7;
               : 804849d:	movl   $0x7,-0x14(%ebp)
               :  int c1 = 0;
               : 80484a4:	movl   $0x0,-0x10(%ebp)
               :  int c2 = 0;
               : 80484ab:	movl   $0x0,-0xc(%ebp)
               :  
               :  for (i=1; i < count; ++i)
               : 80484b2:	movl   $0x1,-0x18(%ebp)
               : 80484b9:	jmp    8048507 <main+0x83>
               :  {
               :    s = (s + 7) % 10;
               : 80484bb:	mov    -0x14(%ebp),%eax
               : 80484be:	lea    0x7(%eax),%ecx
               : 80484c1:	movl   $0x66666667,-0x2c(%ebp)
               : 80484c8:	mov    -0x2c(%ebp),%eax
               : 80484cb:	imul   %ecx
               : 80484cd:	sar    $0x2,%edx
               : 80484d0:	mov    %ecx,%eax
               : 80484d2:	sar    $0x1f,%eax
               : 80484d5:	mov    %edx,%ebx
               : 80484d7:	sub    %eax,%ebx
               : 80484d9:	mov    %ebx,%eax
               : 80484db:	mov    %eax,-0x14(%ebp)
               : 80484de:	mov    -0x14(%ebp),%edx
               : 80484e1:	mov    %edx,%eax
               : 80484e3:	shl    $0x2,%eax
               : 80484e6:	add    %edx,%eax
               : 80484e8:	add    %eax,%eax
               : 80484ea:	mov    %ecx,%edx
               : 80484ec:	sub    %eax,%edx
               : 80484ee:	mov    %edx,%eax
               : 80484f0:	mov    %eax,-0x14(%ebp)
               :    if (s < 5)
               : 80484f3:	cmpl   $0x4,-0x14(%ebp)
               : 80484f7:	jg     80484ff <main+0x7b>
               :    {
               :      ++c1;
               : 80484f9:	addl   $0x1,-0x10(%ebp)
               : 80484fd:	jmp    8048503 <main+0x7f>
               :    }
               :    else
               :    {
               :      ++c2;
               : 80484ff:	addl   $0x1,-0xc(%ebp)
               :  
               :  int s = 7;
               :  int c1 = 0;
               :  int c2 = 0;
               :  
               :  for (i=1; i < count; ++i)
    11 100.000 : 8048503:	addl   $0x1,-0x18(%ebp)
               : 8048507:	mov    -0x18(%ebp),%eax
               : 804850a:	cmp    -0x1c(%ebp),%eax
               : 804850d:	jl     80484bb <main+0x37>
               :      ++c2;
               :    }
               :    
               :  }
               :  
               :  printf("c1=%d c2=%d\n", c1, c2);
               : 804850f:	mov    -0xc(%ebp),%eax
               : 8048512:	mov    %eax,0x8(%esp)
               : 8048516:	mov    -0x10(%ebp),%eax
               : 8048519:	mov    %eax,0x4(%esp)
               : 804851d:	movl   $0x8048600,(%esp)
               : 8048524:	call   80483ac <printf@plt>
               :  
               :  return 0;
               : 8048529:	mov    $0x0,%eax
               :}
               : 804852e:	add    $0x30,%esp
               : 8048531:	pop    %ecx
               : 8048532:	pop    %ebx
               : 8048533:	pop    %ebp
               : 8048534:	lea    -0x4(%ecx),%esp
               : 8048537:	ret    
               : 8048538:	nop    
               : 8048539:	nop    
               : 804853a:	nop    
               : 804853b:	nop    
               : 804853c:	nop    
               : 804853d:	nop    
               : 804853e:	nop    
               : 804853f:	nop    
               :Disassembly of section .fini:
