#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    return 2;
  }
  char *key = (char *)malloc(0x20);
  strncpy(key, "f222e18ee5a3d7bf8c47e055d47b8830", 0x20);
  for (int i = 0; i < 0x20; i++) {
    if (argv[1][i] != key[i])
      return 0;
  }
  printf("You win! Go grab a prize!\n");
  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)
cmpl   $0x2,-0x8(%rbp)
je     115c <main+0x2c>
movl   $0x2,-0x4(%rbp)
jmp    11e6 <main+0xb6>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe8b(%rip),%rsi
mov    $0x20,%edx
call   1030 <strncpy@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    11d3 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11c0 <main+0x90>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <main+0xb6>
jmp    11c5 <main+0x95>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1186 <main+0x56>
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x2,%r14d
cmp    $0x2,%edi
jne    11b0 <main+0x80>
mov    %rsi,%r15
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea9(%rip),%rsi
mov    %rax,%rdi
mov    $0x20,%edx
call   1030 <strncpy@plt>
mov    0x8(%r15),%rax
xor    %r14d,%r14d
xor    %ecx,%ecx
nopl   (%rax)
movzbl (%rax,%rcx,1),%edx
cmp    (%rbx,%rcx,1),%dl
jne    11b0 <main+0x80>
movzbl 0x1(%rax,%rcx,1),%edx
cmp    0x1(%rbx,%rcx,1),%dl
jne    11b0 <main+0x80>
movzbl 0x2(%rax,%rcx,1),%edx
cmp    0x2(%rbx,%rcx,1),%dl
jne    11b0 <main+0x80>
movzbl 0x3(%rax,%rcx,1),%edx
cmp    0x3(%rbx,%rcx,1),%dl
jne    11b0 <main+0x80>
add    $0x4,%rcx
cmp    $0x20,%rcx
jne    1170 <main+0x40>
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"f222e18ee5a3d7bf8c47e055d47b8830\00"
@.str.1 = [27 x i8] c"You win! Go grab a prize!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 2, i32* %3
br label %42
11: ; preds = %2
%12 = call i64 @malloc(i32 32)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = call i32 @strncpy(i8* %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 32)
store i32 0, i32* %7
br label %16
16: ; preds = %37, %11
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 32
br i1 %18, label %19, label %40
19: ; preds = %16
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = load i8*, i8** %6
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %27, %33
br i1 %34, label %35, label %36
35: ; preds = %19
store i32 0, i32* %3
br label %42
36: ; preds = %19
br label %37
37: ; preds = %36
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %16
40: ; preds = %16
%41 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %42
42: ; preds = %40, %35, %10
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str = [33 x i8] c"f222e18ee5a3d7bf8c47e055d47b8830\00"
@str = [26 x i8] c"You win! Go grab a prize!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %43
4: ; preds = %2
%5 = tail call i64 @malloc(i32 32)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 32)
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
br label %34
10: ; preds = %34
%11 = or i64 %35, 1
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %6, i64 %11
%15 = load i8, i8* %14
%16 = icmp eq i8 %13, %15
br i1 %16, label %17, label %43
17: ; preds = %10
%18 = or i64 %35, 2
%19 = getelementptr inbounds i8, i8* %9, i64 %18
%20 = load i8, i8* %19
%21 = getelementptr inbounds i8, i8* %6, i64 %18
%22 = load i8, i8* %21
%23 = icmp eq i8 %20, %22
br i1 %23, label %24, label %43
24: ; preds = %17
%25 = or i64 %35, 3
%26 = getelementptr inbounds i8, i8* %9, i64 %25
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %6, i64 %25
%29 = load i8, i8* %28
%30 = icmp eq i8 %27, %29
br i1 %30, label %31, label %43
31: ; preds = %24
%32 = add nuw nsw i64 %35, 4
%33 = icmp eq i64 %32, 32
br i1 %33, label %41, label %34
34: ; preds = %31, %4
%35 = phi i64 [ 0, %4 ], [ %32, %31 ]
%36 = getelementptr inbounds i8, i8* %9, i64 %35
%37 = load i8, i8* %36
%38 = getelementptr inbounds i8, i8* %6, i64 %35
%39 = load i8, i8* %38
%40 = icmp eq i8 %37, %39
br i1 %40, label %10, label %43
41: ; preds = %31
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %43
43: ; preds = %34, %10, %17, %24, %41, %2
%44 = phi i32 [ 2, %2 ], [ 0, %41 ], [ 0, %24 ], [ 0, %17 ], [ 0, %10 ], [ 0, %34 ]
ret i32 %44
}