/* 
 * 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 0x02 (branch not-taken mispredicted) count 3000
 */
               :
               :/root/programy/branch-prediction:     file format elf32-i386
               :
               :Disassembly of section .init:
               :Disassembly of section .plt:
               :Disassembly of section .text:
               :
080484b4 <main>: /* main total:  83277 100.000 */
               :#include <stdio.h>
               :#include <stdlib.h>
               :
               :int main(int argc, char **argv)
               : 80484b4:	lea    0x4(%esp),%ecx
               : 80484b8:	and    $0xfffffff0,%esp
               : 80484bb:	pushl  -0x4(%ecx)
               : 80484be:	push   %ebp
               : 80484bf:	mov    %esp,%ebp
               : 80484c1:	push   %ebx
               : 80484c2:	push   %ecx
               : 80484c3:	sub    $0x30,%esp
               :{
               :  int count = 1000000000;
               : 80484c6:	movl   $0x3b9aca00,-0x1c(%ebp)
               :  int i;
               :  
               :  int s = 7;
               : 80484cd:	movl   $0x7,-0x14(%ebp)
               :  int c1 = 0;
               : 80484d4:	movl   $0x0,-0x10(%ebp)
               :  int c2 = 0;
               : 80484db:	movl   $0x0,-0xc(%ebp)
               :  
               :  for (i=1; i < count; ++i)
               : 80484e2:	movl   $0x1,-0x18(%ebp)
               : 80484e9:	jmp    8048542 <main+0x8e>
               :  {
               :    s = (s + 7) % 10;
               : 80484eb:	mov    -0x14(%ebp),%eax
               : 80484ee:	lea    0x7(%eax),%ecx
               : 80484f1:	movl   $0x66666667,-0x2c(%ebp)
               : 80484f8:	mov    -0x2c(%ebp),%eax
               : 80484fb:	imul   %ecx
               : 80484fd:	sar    $0x2,%edx
               : 8048500:	mov    %ecx,%eax
               : 8048502:	sar    $0x1f,%eax
               : 8048505:	mov    %edx,%ebx
               : 8048507:	sub    %eax,%ebx
               : 8048509:	mov    %ebx,%eax
               : 804850b:	mov    %eax,-0x14(%ebp)
               : 804850e:	mov    -0x14(%ebp),%edx
               : 8048511:	mov    %edx,%eax
               : 8048513:	shl    $0x2,%eax
               : 8048516:	add    %edx,%eax
               : 8048518:	add    %eax,%eax
               : 804851a:	mov    %ecx,%edx
               : 804851c:	sub    %eax,%edx
               : 804851e:	mov    %edx,%eax
               : 8048520:	mov    %eax,-0x14(%ebp)
               :    if (rand() % 2 == 0)
               : 8048523:	call   80483dc <rand@plt>
               : 8048528:	and    $0x1,%eax
               : 804852b:	test   %eax,%eax
               : 804852d:	sete   %al
               : 8048530:	test   %al,%al
               : 8048532:	je     804853a <main+0x86>
               :    {
               :      ++c1;
               : 8048534:	addl   $0x1,-0x10(%ebp)
 83063 99.7430 : 8048538:	jmp    804853e <main+0x8a>
               :    }
               :    else
               :    {
               :      ++c2;
               : 804853a:	addl   $0x1,-0xc(%ebp)
               :  
               :  int s = 7;
               :  int c1 = 0;
               :  int c2 = 0;
               :  
               :  for (i=1; i < count; ++i)
               : 804853e:	addl   $0x1,-0x18(%ebp)
   214  0.2570 : 8048542:	mov    -0x18(%ebp),%eax
               : 8048545:	cmp    -0x1c(%ebp),%eax
               : 8048548:	jl     80484eb <main+0x37>
               :      ++c2;
               :    }
               :    
               :  }
               :  
               :  printf("c1=%d c2=%d\n", c1, c2);
               : 804854a:	mov    -0xc(%ebp),%eax
               : 804854d:	mov    %eax,0x8(%esp)
               : 8048551:	mov    -0x10(%ebp),%eax
               : 8048554:	mov    %eax,0x4(%esp)
               : 8048558:	movl   $0x8048640,(%esp)
               : 804855f:	call   80483cc <printf@plt>
               :  
               :  return 0;
               : 8048564:	mov    $0x0,%eax
               :}
               : 8048569:	add    $0x30,%esp
               : 804856c:	pop    %ecx
               : 804856d:	pop    %ebx
               : 804856e:	pop    %ebp
               : 804856f:	lea    -0x4(%ecx),%esp
               : 8048572:	ret    
               : 8048573:	nop    
               : 8048574:	nop    
               : 8048575:	nop    
               : 8048576:	nop    
               : 8048577:	nop    
               : 8048578:	nop    
               : 8048579:	nop    
               : 804857a:	nop    
               : 804857b:	nop    
               : 804857c:	nop    
               : 804857d:	nop    
               : 804857e:	nop    
               : 804857f:	nop    
               :Disassembly of section .fini:
