#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 short *, unsigned short *);
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 short input[1];
  unsigned short output[1];
  int randomFuns_i5;
  unsigned short 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 short)strtoul(argv[randomFuns_i5 + 1], 0, 10);
      input[randomFuns_i5] = randomFuns_value6;
      randomFuns_i5++;
    }
    RandomFunc(input, output);
    if (output[0] == 52935) {
      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    11e6 <main+0x96>
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    %ax,-0x1a(%rbp)
mov    -0x1a(%rbp),%cx
movslq -0x18(%rbp),%rax
mov    %cx,-0x12(%rbp,%rax,2)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a0 <main+0x50>
lea    -0x12(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <RandomFunc@plt>
movzwl -0x14(%rbp),%eax
cmp    $0xcec7,%eax
jne    1215 <main+0xc5>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121a <main+0xca>
jmp    121a <main+0xca>
movl   $0x0,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jge    1250 <main+0x100>
movslq -0x20(%rbp),%rax
movzwl -0x14(%rbp,%rax,2),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1221 <main+0xd1>
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    11cf <main+0x6f>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %ax,0x6(%rsp)
lea    0x6(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1060 <RandomFunc@plt>
movzwl 0x4(%rsp),%eax
cmp    $0xcec7,%eax
jne    11b5 <main+0x55>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
movzwl 0x4(%rsp),%eax
movzwl %ax,%esi
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe2a(%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 i16]
%7 = alloca [1 x i16]
%8 = alloca i32
%9 = alloca i16
%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 i16
store i16 %30, i16* %9
%31 = load i16, i16* %9
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [1 x i16], [1 x i16]* %6, i64 0, i64 %33
store i16 %31, i16* %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 i16], [1 x i16]* %6, i64 0, i64 0
%39 = getelementptr inbounds [1 x i16], [1 x i16]* %7, i64 0, i64 0
%40 = call i32 @RandomFunc(i16* %38, i16* %39)
%41 = getelementptr inbounds [1 x i16], [1 x i16]* %7, i64 0, i64 0
%42 = load i16, i16* %41
%43 = zext i16 %42 to i32
%44 = icmp eq i32 %43, 52935
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 i16], [1 x i16]* %7, i64 0, i64 %54
%56 = load i16, i16* %55
%57 = zext i16 %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 i16]
%4 = alloca [1 x i16]
%5 = bitcast [1 x i16]* %3 to i8*
%6 = bitcast [1 x i16]* %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 = trunc i64 %15 to i16
%17 = getelementptr inbounds [1 x i16], [1 x i16]* %3, i64 0, i64 0
store i16 %16, i16* %17
%18 = getelementptr inbounds [1 x i16], [1 x i16]* %4, i64 0, i64 0
%19 = call i32 @RandomFunc(i16* %17, i16* %18)
%20 = load i16, i16* %18
%21 = icmp eq i16 %20, -12601
br i1 %21, label %22, label %25
22: ; preds = %12
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%24 = load i16, i16* %18
br label %25
25: ; preds = %12, %22
%26 = phi i16 [ %20, %12 ], [ %24, %22 ]
%27 = zext i16 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
ret i32 0
}