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


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   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,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jge    11e3 <main+0x93>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtoul@plt>
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x11(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a0 <main+0x50>
lea    -0x11(%rbp),%rdi
lea    -0x12(%rbp),%rsi
call   1050 <RandomFunc@plt>
movzbl -0x12(%rbp),%eax
cmp    $0x1,%eax
jne    1210 <main+0xc0>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1215 <main+0xc5>
jmp    1215 <main+0xc5>
movl   $0x0,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jge    124b <main+0xfb>
movslq -0x20(%rbp),%rax
movzbl -0x12(%rbp,%rax,1),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    121c <main+0xcc>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <megaInit@plt>
cmp    $0x2,%ebp
jne    11c9 <main+0x69>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %al,0x7(%rsp)
lea    0x7(%rsp),%rdi
lea    0x6(%rsp),%rsi
call   1060 <RandomFunc@plt>
mov    0x6(%rsp),%al
cmp    $0x1,%al
jne    11af <main+0x4f>
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
mov    0x6(%rsp),%al
movzbl %al,%esi
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe30(%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 = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1 x i8]
%7 = alloca [1 x i8]
%8 = alloca i32
%9 = alloca i8
%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 %37
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)
%30 = trunc i64 %29 to i8
store i8 %30, i8* %9
%31 = load i8, i8* %9
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [1 x i8], [1 x i8]* %6, i64 0, i64 %33
store i8 %31, i8* %34
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %19
37: ; preds = %19
%38 = getelementptr inbounds [1 x i8], [1 x i8]* %6, i64 0, i64 0
%39 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
%40 = call i32 @RandomFunc(i8* %38, i8* %39)
%41 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %37
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %48
47: ; preds = %37
br label %48
48: ; preds = %47, %45
store i32 0, i32* %10
br label %49
49: ; preds = %52, %48
%50 = load i32, i32* %10
%51 = icmp slt i32 %50, 1
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %10
%60 = add nsw i32 %59, 1
store i32 %60, i32* %10
br label %49
61: ; preds = %49
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
@.str = [37 x i8] c"Call this program with %i arguments\0A\00"
@.str.2 = [4 x i8] c"%u\0A\00"
@str = [9 x i8] c"You win!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1 x i8]
%4 = alloca [1 x i8]
%5 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
%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 = trunc i64 %15 to i8
store i8 %16, i8* %5
%17 = call i32 @RandomFunc(i8* %5, i8* %6)
%18 = load i8, i8* %6
%19 = icmp eq i8 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%22 = load i8, i8* %6
br label %23
23: ; preds = %12, %20
%24 = phi i8 [ %18, %12 ], [ %22, %20 ]
%25 = zext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %25)
ret i32 0
}