#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 */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strtok(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i;
  time_t var0 = time(NULL);
  srand(var0);
  int var1 = 0;
  char buf0[500];
  char buf1[500];
  for (i = 0; i < 50; i++) {
    int var2 = rand() % 100;
    printf("%d days without an incident.\n", i);
    sprintf(buf1, "%d", var2);
    scanf(" %10s", buf0);
    strtok(buf0, "\n");
    if (strcmp(buf1, buf0) != 0) {
      printf("Well that didn't take long.\n");
      printf("You should have used %s.\n", buf1);
      exit(0);
    }
  }
  printf("How very unpredictable. Level Cleared\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <srand@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    128d <main+0xfd>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x414(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    -0x414(%rbp),%edx
lea    0xe16(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x210(%rbp),%rsi
lea    0xe06(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x210(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1080 <strtok@plt>
lea    -0x410(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     127a <main+0xea>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x410(%rbp),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
jmp    127f <main+0xef>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c4 <main+0x34>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    %rsp,%r13
lea    0xe58(%rip),%r12
lea    0x200(%rsp),%rbx
lea    0xe67(%rip),%rbp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <rand@plt>
movslq %eax,%r15
imul   $0x51eb851f,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%r15d
lea    0xdf5(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
lea    0xdff(%rip),%rsi
mov    %r15d,%edx
call   10a0 <sprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <strtok@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1277 <main+0xd7>
add    $0x1,%r14d
cmp    $0x32,%r14d
jne    11e0 <main+0x40>
lea    0xde3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde9(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9d(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"%d days without an incident.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c" %10s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [29 x i8] c"Well that didn't take long.\0A\00"
@.str.5 = [26 x i8] c"You should have used %s.\0A\00"
@.str.6 = [39 x i8] c"How very unpredictable. Level Cleared\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [500 x i8]
%6 = alloca [500 x i8]
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @time(i32* null)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %4
store i32 0, i32* %2
br label %11
11: ; preds = %36, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 50
br i1 %13, label %14, label %39
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 100
store i32 %16, i32* %7
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%20 = load i32, i32* %7
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%23 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%25 = call i32 @strtok(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%28 = call i64 @strcmp(i8* %26, i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %14
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%32 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %32)
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %14
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %11
39: ; preds = %11
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [30 x i8] c"%d days without an incident.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c" %10s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.5 = [26 x i8] c"You should have used %s.\0A\00"
@str = [38 x i8] c"How very unpredictable. Level Cleared\00"
@str.7 = [28 x i8] c"Well that didn't take long.\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = alloca [500 x i8]
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
br label %10
7: ; preds = %10
%8 = add nuw nsw i32 %11, 1
%9 = icmp eq i32 %8, 50
br i1 %9, label %24, label %10
10: ; preds = %0, %7
%11 = phi i32 [ 0, %0 ], [ %8, %7 ]
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 100
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %11)
%15 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%16 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%17 = call i32 @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = call i64 @strcmp(i8* %6, i8* %5)
%19 = icmp eq i64 %18, 0
br i1 %19, label %7, label %20
20: ; preds = %10
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %7
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
ret i32 0
}