#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(int argc __attribute__((unused)),
         char *argv[] __attribute__((unused))) {
  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    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%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,-0x14(%rbp)
cmpl   $0x1000,-0x14(%rbp)
jge    11be <main+0x5e>
mov    $0x0,%al
call   1080 <initialise_benchmark@plt>
mov    $0x0,%al
call   1060 <benchmark@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1192 <main+0x32>
mov    $0x0,%al
call   1040 <stop_trigger@plt>
mov    -0x18(%rbp),%edi
call   1050 <verify_benchmark@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @initialise_board()
%10 = call i32 (...) @initialise_benchmark()
%11 = call i32 (...) @start_trigger()
store i32 0, i32* %6
br label %12
12: ; preds = %18, %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 4096
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = call i32 (...) @initialise_benchmark()
%17 = call i32 (...) @benchmark()
store volatile i32 %17, i32* %7
br label %18
18: ; preds = %15
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %12
21: ; preds = %12
%22 = call i32 (...) @stop_trigger()
%23 = load volatile i32, i32* %7
%24 = call i32 @verify_benchmark(i32 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
ret i32 %28
}

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