#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*/ RandomFunc(unsigned long *, unsigned long *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ megaInit();
int /*<<< orphan*/ printf(char *, ...);
unsigned long strtoul(char *, int /*<<< orphan*/, int);
int main(int argc, char *argv[]) {
  unsigned long input[1];
  unsigned long output[1];
  int randomFuns_i5;
  unsigned long randomFuns_value6;
  int randomFuns_main_i7;
  {
    megaInit();
    if (argc != 2) {
      printf("Call this program with %i arguments\n", 1);
      exit(-1);
    } else {
    }
    randomFuns_i5 = 0;
    while (randomFuns_i5 < 1) {
      randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10);
      input[randomFuns_i5] = randomFuns_value6;
      randomFuns_i5++;
    }
    RandomFunc(input, output);
    if (output[0] == 0UL) {
      printf("You win!\n");
    } else {
    }
    randomFuns_main_i7 = 0;
    while (randomFuns_main_i7 < 1) {
      printf("%lu\n", output[randomFuns_main_i7]);
      randomFuns_main_i7++;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <megaInit@plt>
cmpl   $0x2,-0x8(%rbp)
je     1194 <main+0x44>
lea    0xe82(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
jmp    1199 <main+0x49>
movl   $0x0,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jge    11e6 <main+0x96>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtoul@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
movslq -0x24(%rbp),%rax
mov    %rcx,-0x18(%rbp,%rax,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a0 <main+0x50>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <RandomFunc@plt>
cmpq   $0x0,-0x20(%rbp)
jne    1211 <main+0xc1>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1216 <main+0xc6>
jmp    1216 <main+0xc6>
movl   $0x0,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jge    124c <main+0xfc>
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    121d <main+0xcd>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <megaInit@plt>
cmp    $0x2,%ebp
jne    11cd <main+0x6d>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1060 <RandomFunc@plt>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
jne    11b6 <main+0x56>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%rsi
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe2c(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Call this program with %i arguments\0A\00"
@.str.1 = [10 x i8] c"You win!\0A\00"
@.str.2 = [5 x i8] c"%lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1 x i64]
%7 = alloca [1 x i64]
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (...) @megaInit()
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 1)
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
br label %18
18: ; preds = %17
store i32 0, i32* %8
br label %19
19: ; preds = %22, %18
%20 = load i32, i32* %8
%21 = icmp slt i32 %20, 1
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strtoul(i8* %28, i32 0, i32 10)
store i64 %29, i64* %9
%30 = load i64, i64* %9
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1 x i64], [1 x i64]* %6, i64 0, i64 %32
store i64 %30, i64* %33
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %19
36: ; preds = %19
%37 = getelementptr inbounds [1 x i64], [1 x i64]* %6, i64 0, i64 0
%38 = getelementptr inbounds [1 x i64], [1 x i64]* %7, i64 0, i64 0
%39 = call i32 @RandomFunc(i64* %37, i64* %38)
%40 = getelementptr inbounds [1 x i64], [1 x i64]* %7, i64 0, i64 0
%41 = load i64, i64* %40
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %46
45: ; preds = %36
br label %46
46: ; preds = %45, %43
store i32 0, i32* %10
br label %47
47: ; preds = %50, %46
%48 = load i32, i32* %10
%49 = icmp slt i32 %48, 1
br i1 %49, label %50, label %58
50: ; preds = %47
%51 = load i32, i32* %10
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1 x i64], [1 x i64]* %7, i64 0, i64 %52
%54 = load i64, i64* %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %54)
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %47
58: ; preds = %47
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@.str = [37 x i8] c"Call this program with %i arguments\0A\00"
@.str.2 = [5 x i8] c"%lu\0A\00"
@str = [9 x i8] c"You win!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1 x i64]
%4 = alloca [1 x i64]
%5 = bitcast [1 x i64]* %3 to i8*
%6 = bitcast [1 x i64]* %4 to i8*
%7 = tail call i32 (...) @megaInit()
%8 = icmp eq i32 %0, 2
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 1)
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i64 @strtoul(i8* %14, i32 0, i32 10)
%16 = getelementptr inbounds [1 x i64], [1 x i64]* %3, i64 0, i64 0
store i64 %15, i64* %16
%17 = getelementptr inbounds [1 x i64], [1 x i64]* %4, i64 0, i64 0
%18 = call i32 @RandomFunc(i64* %16, i64* %17)
%19 = load i64, i64* %17
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %12
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%23 = load i64, i64* %17
br label %24
24: ; preds = %12, %21
%25 = phi i64 [ %19, %12 ], [ %23, %21 ]
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %25)
ret i32 0
}