#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void printHeader(int inputs) {
  int i;
  time_t genTime;
  time(&genTime);
  printf(";Parity Benchmark\n");
  printf(";Generated: %s", asctime(localtime(&genTime)));
  printf(";#Inputs:   %d\n\n", inputs);
  printf(";Program by: Matt White  (mwhite+@cmu.edu)\n");
  printf(";  Any questions should be directed to neural-bench@cs.cmu.edu.");
  printf("\n\n");
  printf("$SETUP\n\n");
  printf("PROTOCOL: IO;\n");
  printf("OFFSET: 0;\n");
  printf("INPUTS: %d;\n", inputs);
  printf("OUTPUTS: 1;\n\n");
  for (i = 1; i <= inputs; i++)
    printf("IN [%d]: BINARY;\n", i);
  printf("OUT [1]: BINARY;\n\n\n");
  printf("$TRAIN\n\n");
}


x86 assembly (clang, -O0):
<printHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1060 <time@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1239 <printHeader+0xf9>
mov    -0x8(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120e <printHeader+0xce>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHeader>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%r14d
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <time@plt>
lea    0xf0f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1050 <asctime@plt>
lea    0xe75(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe73(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf34(%rip),%rdi
call   1040 <puts@plt>
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
lea    0xee5(%rip),%rdi
call   1040 <puts@plt>
lea    0xee7(%rip),%rdi
call   1040 <puts@plt>
lea    0xe69(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    124f <printHeader+0xff>
neg    %r14d
mov    $0x1,%ebx
lea    0xe4c(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1230 <printHeader+0xe0>
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c";Parity Benchmark\0A\00"
@.str.1 = [15 x i8] c";Generated: %s\00"
@.str.2 = [17 x i8] c";#Inputs: %d\0A\0A\00"
@.str.3 = [44 x i8] c";Program by: Matt White (mwhite+@cmu.edu)\0A\00"
@.str.4 = [64 x i8] c"; Any questions should be directed to neural-bench@cs.cmu.edu.\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
@.str.6 = [9 x i8] c"$SETUP\0A\0A\00"
@.str.7 = [15 x i8] c"PROTOCOL: IO;\0A\00"
@.str.8 = [12 x i8] c"OFFSET: 0;\0A\00"
@.str.9 = [13 x i8] c"INPUTS: %d;\0A\00"
@.str.10 = [14 x i8] c"OUTPUTS: 1;\0A\0A\00"
@.str.11 = [18 x i8] c"IN [%d]: BINARY;\0A\00"
@.str.12 = [20 x i8] c"OUT [1]: BINARY;\0A\0A\0A\00"
@.str.13 = [9 x i8] c"$TRAIN\0A\0A\00"
define void @printHeader(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @time(i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @localtime(i32* %4)
%8 = call i8* @asctime(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %21
21: ; preds = %28, %1
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %21
31: ; preds = %21
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c";Generated: %s\00"
@.str.2 = [17 x i8] c";#Inputs: %d\0A\0A\00"
@.str.4 = [64 x i8] c"; Any questions should be directed to neural-bench@cs.cmu.edu.\00"
@.str.9 = [13 x i8] c"INPUTS: %d;\0A\00"
@.str.11 = [18 x i8] c"IN [%d]: BINARY;\0A\00"
@str = [18 x i8] c";Parity Benchmark\00"
@str.14 = [43 x i8] c";Program by: Matt White (mwhite+@cmu.edu)\00"
@str.15 = [2 x i8] c"\0A\00"
@str.16 = [8 x i8] c"$SETUP\0A\00"
@str.17 = [14 x i8] c"PROTOCOL: IO;\00"
@str.18 = [11 x i8] c"OFFSET: 0;\00"
@str.19 = [13 x i8] c"OUTPUTS: 1;\0A\00"
@str.20 = [19 x i8] c"OUT [1]: BINARY;\0A\0A\00"
@str.21 = [8 x i8] c"$TRAIN\0A\00"
define void @printHeader(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @time(i32* %2)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = call i32 @localtime(i32* %2)
%7 = call i8* @asctime(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.14, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.16, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.18, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %0)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.19, i64 0, i64 0))
%18 = icmp slt i32 %0, 1
br i1 %18, label %24, label %19
19: ; preds = %1, %19
%20 = phi i32 [ %22, %19 ], [ 1, %1 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %20)
%22 = add nuw i32 %20, 1
%23 = icmp eq i32 %20, %0
br i1 %23, label %24, label %19
24: ; preds = %19, %1
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.21, i64 0, i64 0))
ret void
}