#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 benchmark();
int /*<<< orphan*/ initialise_benchmark();
int /*<<< orphan*/ initialise_board();
int /*<<< orphan*/ start_trigger();
int /*<<< orphan*/ stop_trigger();
int verify_benchmark(int volatile);
int main(void) {
  int i;
  volatile int result;
  int correct;
  initialise_board();
  initialise_benchmark();
  start_trigger();
  for (i = 0; i < (((0) > 0) ? (4096) >> (0) : (4096) << (-0)); i++) {
    initialise_benchmark();
    result = benchmark();
  }
  stop_trigger();
  correct = verify_benchmark(result);
  return (!correct);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <initialise_board@plt>
mov    $0x0,%al
call   1080 <initialise_benchmark@plt>
mov    $0x0,%al
call   1030 <start_trigger@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    11b7 <main+0x57>
mov    $0x0,%al
call   1080 <initialise_benchmark@plt>
mov    $0x0,%al
call   1060 <benchmark@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118b <main+0x2b>
mov    $0x0,%al
call   1040 <stop_trigger@plt>
mov    -0xc(%rbp),%edi
call   1050 <verify_benchmark@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1070 <initialise_board@plt>
xor    %eax,%eax
call   1080 <initialise_benchmark@plt>
xor    %eax,%eax
call   1030 <start_trigger@plt>
mov    $0x1000,%ebx
nop
xor    %eax,%eax
call   1080 <initialise_benchmark@plt>
xor    %eax,%eax
call   1060 <benchmark@plt>
mov    %eax,0xc(%rsp)
add    $0xffffffff,%ebx
jne    1180 <main+0x20>
xor    %eax,%eax
call   1040 <stop_trigger@plt>
mov    0xc(%rsp),%edi
call   1050 <verify_benchmark@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @initialise_board()
%6 = call i32 (...) @initialise_benchmark()
%7 = call i32 (...) @start_trigger()
store i32 0, i32* %2
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 4096
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = call i32 (...) @initialise_benchmark()
%13 = call i32 (...) @benchmark()
store volatile i32 %13, i32* %3
br label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %8
17: ; preds = %8
%18 = call i32 (...) @stop_trigger()
%19 = load volatile i32, i32* %3
%20 = call i32 @verify_benchmark(i32 %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @initialise_board()
%4 = tail call i32 (...) @initialise_benchmark()
%5 = tail call i32 (...) @start_trigger()
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 0, %0 ], [ %10, %6 ]
%8 = tail call i32 (...) @initialise_benchmark()
%9 = tail call i32 (...) @benchmark()
store volatile i32 %9, i32* %1
%10 = add nuw nsw i32 %7, 1
%11 = icmp eq i32 %10, 4096
br i1 %11, label %12, label %6
12: ; preds = %6
%13 = tail call i32 (...) @stop_trigger()
%14 = load volatile i32, i32* %1
%15 = tail call i32 @verify_benchmark(i32 %14)
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}