#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ fulfills_goldbach_theory(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int i;
  printf("Test of Goldbach!\n");
  for (i = 7; i < 2000000; i++) {
    if (!fulfills_goldbach_theory(i)) {
      printf("Theory failed!\n");
      break;
    }
  }
  printf("Finished!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
movl   $0x7,-0x8(%rbp)
cmpl   $0x1e8480,-0x8(%rbp)
jge    1184 <main+0x64>
mov    -0x8(%rbp),%edi
call   1040 <fulfills_goldbach_theory@plt>
cmp    $0x0,%eax
jne    1171 <main+0x51>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    1184 <main+0x64>
jmp    1176 <main+0x56>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x22>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x7,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
call   1050 <fulfills_goldbach_theory@plt>
test   %eax,%eax
je     1168 <main+0x38>
add    $0x1,%ebx
cmp    $0x1e8480,%ebx
jne    1150 <main+0x20>
jmp    1174 <main+0x44>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Test of Goldbach!\0A\00"
@.str.1 = [16 x i8] c"Theory failed!\0A\00"
@.str.2 = [10 x i8] c"Finished!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 7, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 2000000
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @fulfills_goldbach_theory(i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %17
13: ; preds = %7
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %11, %4
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [10 x i8] c"Finished!\00"
@str = [18 x i8] c"Test of Goldbach!\00"
@str.3 = [15 x i8] c"Theory failed!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %5
2: ; preds = %5
%3 = add nuw nsw i32 %6, 1
%4 = icmp eq i32 %3, 2000000
br i1 %4, label %11, label %5
5: ; preds = %0, %2
%6 = phi i32 [ 7, %0 ], [ %3, %2 ]
%7 = tail call i32 @fulfills_goldbach_theory(i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %2
9: ; preds = %5
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0))
br label %11
11: ; preds = %2, %9
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}