// File: /workspace/github_c_makefile_star2_O0/accre[P]Cprogramming/flow_control.c
// Function: main
int main()
{

  int i = 1;

  // native boolean variables don't exist in C
  // Integers are typically used instead, with a 
  // value of 0 evaluated as false and a non-zero
  // value evaluated as true
  if ( i ) printf("i is true with value of: %d\n",i);
  i = 123;
  if ( i ) printf("i is true with value of: %d\n",i);
  i = -321;
  if ( i ) printf("i is true with value of: %d\n",i);

  i = 0;
  if ( i ) {
     printf("i is true with value of: %d\n",i);
  }
  else {
     printf("i is false with value of: %d\n",i);
  }

  int y = 26;

  // Note that in a large if-else block like the one
  // below, program flow jumps out of the block after
  // the first condition is met, and its contents are 
  // executed. This is why "condition 5 is met!" is not
  // printed.
  if ( i > 0 && y == 26 ) {
     printf("condition 1 met!\n");
  }
  else if ( i > 0 || y == 25 ) {
     printf("condition 2 met!\n");
  }
  else if ( i != 0 ) {
     printf("condition 3 met!\n");
  }
  else if ( !i && y >= 20 ) {
     printf("condition 4 met!\n");
  }
  else if ( i == 0 ) {
     printf("condition 5 met!\n");
  }
  else {
     printf("no condition met!\n");
  }

  // nested if-else blocks are also allowed
  if ( y == 26 ) {
     if ( i != 0 ) {
        printf("i is not zero!\n");
     }
     else {
        printf("i is zero\n");
     }
  }

  return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl $0x1, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x116d
movl -0x8(%rbp), %esi
leaq 0xe9e(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1030
movl $0x7b, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x118b
movl -0x8(%rbp), %esi
leaq 0xe80(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1030
movl $0xfffffebf, -0x8(%rbp) # imm = 0xFFFFFEBF
cmpl $0x0, -0x8(%rbp)
je 0x11a9
movl -0x8(%rbp), %esi
leaq 0xe62(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1030
movl $0x0, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x11c9
movl -0x8(%rbp), %esi
leaq 0xe44(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1030
jmp 0x11da
movl -0x8(%rbp), %esi
leaq 0xe4e(%rip), %rdi       # 0x2021
movb $0x0, %al
callq 0x1030
movl $0x1a, -0xc(%rbp)
cmpl $0x0, -0x8(%rbp)
jle 0x11fd
cmpl $0x1a, -0xc(%rbp)
jne 0x11fd
leaq 0xe4b(%rip), %rdi       # 0x203f
movb $0x0, %al
callq 0x1030
jmp 0x1277
cmpl $0x0, -0x8(%rbp)
jg 0x1209
cmpl $0x19, -0xc(%rbp)
jne 0x1219
leaq 0xe41(%rip), %rdi       # 0x2051
movb $0x0, %al
callq 0x1030
jmp 0x1275
cmpl $0x0, -0x8(%rbp)
je 0x122f
leaq 0xe3d(%rip), %rdi       # 0x2063
movb $0x0, %al
callq 0x1030
jmp 0x1273
cmpl $0x0, -0x8(%rbp)
jne 0x124b
cmpl $0x14, -0xc(%rbp)
jl 0x124b
leaq 0xe33(%rip), %rdi       # 0x2075
movb $0x0, %al
callq 0x1030
jmp 0x1271
cmpl $0x0, -0x8(%rbp)
jne 0x1261
leaq 0xe2f(%rip), %rdi       # 0x2087
movb $0x0, %al
callq 0x1030
jmp 0x126f
leaq 0xe31(%rip), %rdi       # 0x2099
movb $0x0, %al
callq 0x1030
jmp 0x1271
jmp 0x1273
jmp 0x1275
jmp 0x1277
cmpl $0x1a, -0xc(%rbp)
jne 0x12a3
cmpl $0x0, -0x8(%rbp)
je 0x1293
leaq 0xe22(%rip), %rdi       # 0x20ac
movb $0x0, %al
callq 0x1030
jmp 0x12a1
leaq 0xe22(%rip), %rdi       # 0x20bc
movb $0x0, %al
callq 0x1030
jmp 0x12a3
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq