#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*/ cg_benchmark(int);
int /*<<< orphan*/ fg_benchmark(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  printf("%-10s%-10s%-10s%-10s\n", "Queue", "Threads", "Items",
         "Time (seconds)");
  int q = 2;
  for (int i = 1; i <= q; i *= 2) {
    fg_benchmark(i);
  }
  printf(
      "\n\n------------------------------------------------------------\n\n");
  for (int i = 1; i <= q; i *= 2) {
    cg_benchmark(i);
  }
  return 0;
}


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)
lea    0xeb3(%rip),%rdi
lea    0xec2(%rip),%rsi
lea    0xec1(%rip),%rdx
lea    0xec2(%rip),%rcx
lea    0xec1(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a0 <main+0x70>
mov    -0x18(%rbp),%edi
call   1050 <fg_benchmark@plt>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117e <main+0x4e>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11d7 <main+0xa7>
mov    -0x1c(%rbp),%edi
call   1030 <cg_benchmark@plt>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b5 <main+0x85>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0xec7(%rip),%rsi
lea    0xec6(%rip),%rdx
lea    0xec7(%rip),%rcx
lea    0xec6(%rip),%r8
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <fg_benchmark@plt>
mov    $0x2,%edi
call   1060 <fg_benchmark@plt>
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1030 <cg_benchmark@plt>
mov    $0x2,%edi
call   1030 <cg_benchmark@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%-10s%-10s%-10s%-10s\0A\00"
@.str.1 = [6 x i8] c"Queue\00"
@.str.2 = [8 x i8] c"Threads\00"
@.str.3 = [6 x i8] c"Items\00"
@.str.4 = [15 x i8] c"Time (seconds)\00"
@.str.5 = [65 x i8] c"\0A\0A------------------------------------------------------------\0A\0A\00"
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 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 2, i32* %6
store i32 1, i32* %7
br label %10
10: ; preds = %17, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i32, i32* %7
%16 = call i32 @fg_benchmark(i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %7
%19 = mul nsw i32 %18, 2
store i32 %19, i32* %7
br label %10
20: ; preds = %10
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %8
br label %22
22: ; preds = %29, %20
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i32, i32* %8
%28 = call i32 @cg_benchmark(i32 %27)
br label %29
29: ; preds = %26
%30 = load i32, i32* %8
%31 = mul nsw i32 %30, 2
store i32 %31, i32* %8
br label %22
32: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"%-10s%-10s%-10s%-10s\0A\00"
@.str.1 = [6 x i8] c"Queue\00"
@.str.2 = [8 x i8] c"Threads\00"
@.str.3 = [6 x i8] c"Items\00"
@.str.4 = [15 x i8] c"Time (seconds)\00"
@str = [64 x i8] c"\0A\0A------------------------------------------------------------\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%4 = tail call i32 @fg_benchmark(i32 1)
%5 = tail call i32 @fg_benchmark(i32 2)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @cg_benchmark(i32 1)
%8 = tail call i32 @cg_benchmark(i32 2)
ret i32 0
}