#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*/ gen(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ strcmp(char *, char *);
int main() {
  char token[11];
  unsigned int i;
  do {
    srand(i);
    gen(10, token);
    if (strcmp(token, "2118Jx9w3e") == 0) {
      printf("%d\n", i);
      return 0;
    }
  } while (++i != 0);
  printf("not found\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <srand@plt>
lea    -0xf(%rbp),%rsi
mov    $0xa,%edi
call   1060 <gen@plt>
lea    -0xf(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    119c <main+0x5c>
mov    -0x14(%rbp),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c1 <main+0x81>
jmp    11a1 <main+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    114f <main+0xf>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
call   1050 <srand@plt>
lea    0x5(%rsp),%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
call   1070 <gen@plt>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     118e <main+0x3e>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
jmp    119c <main+0x4c>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"2118Jx9w3e\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [11 x i8] c"not found\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %3
%6 = call i32 @srand(i32 %5)
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%8 = call i32 @gen(i32 10, i8* %7)
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
store i32 0, i32* %1
br label %22
15: ; preds = %4
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = add i32 %17, 1
store i32 %18, i32* %3
%19 = icmp ne i32 %18, 0
br i1 %19, label %4, label %20
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %12
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [11 x i8] c"2118Jx9w3e\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [10 x i8] c"not found\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = call i32 @srand(i32 undef)
%4 = call i32 @gen(i32 10, i8* %2)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 undef)
br label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}