#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 EXIT_FAILURE;
scalar_t__ atoi(char *);
int guess_itr(scalar_t__, scalar_t__);
int guess_rec(scalar_t__, scalar_t__);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int ans;
  if (argc != 4 ||
      (strcmp((argv[1]), "-r") != 0 && strcmp((argv[1]), "-i") != 0) ||
      atoi(argv[2]) > atoi(argv[3]))
    return EXIT_FAILURE;
  else if (strcmp((argv[1]), "-r") == 0)
    ans = guess_rec(atoi(argv[2]), atoi(argv[3]));
  else
    ans = guess_itr(atoi(argv[2]), atoi(argv[3]));
  printf("Your number is %d! Thanks for playing!\n", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    11da <main+0x8a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ac <main+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe66(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11da <main+0x8a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jle    11eb <main+0x9b>
mov    0x2dff(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1283 <main+0x133>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe06(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    123b <main+0xeb>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rsi
call   1060 <guess_rec@plt>
mov    %eax,-0x14(%rbp)
jmp    1268 <main+0x118>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
call   1030 <guess_itr@plt>
mov    %eax,-0x14(%rbp)
jmp    126d <main+0x11d>
mov    -0x14(%rbp),%esi
lea    0xd8f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x4,%edi
jne    11a1 <main+0x51>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1187 <main+0x37>
mov    0x8(%rbx),%rdi
lea    0xe86(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11a1 <main+0x51>
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %rax,%r14
mov    0x18(%rbx),%rdi
call   1070 <atoi@plt>
cmp    %rax,%r14
jle    11b0 <main+0x60>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x8(%rbx),%rdi
lea    0xe45(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %rax,%r14
mov    0x18(%rbx),%rdi
call   1070 <atoi@plt>
mov    %r14,%rdi
mov    %rax,%rsi
test   %r15,%r15
je     11ea <main+0x9a>
call   1030 <guess_itr@plt>
jmp    11ef <main+0x9f>
call   1060 <guess_rec@plt>
lea    0xe10(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11aa <main+0x5a>

LLVM IR (-O0):
@.str = [3 x i8] c"-r\00"
@.str.1 = [3 x i8] c"-i\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [40 x i8] c"Your number is %d! Thanks for playing!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 4
br i1 %8, label %31, label %9
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %31, label %21
21: ; preds = %15, %9
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i64 @atoi(i8* %24)
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 3
%28 = load i8*, i8** %27
%29 = call i64 @atoi(i8* %28)
%30 = icmp sgt i64 %25, %29
br i1 %30, label %31, label %33
31: ; preds = %21, %15, %2
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %3
br label %63
33: ; preds = %21
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %49
39: ; preds = %33
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i64 @atoi(i8* %42)
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 3
%46 = load i8*, i8** %45
%47 = call i64 @atoi(i8* %46)
%48 = call i32 @guess_rec(i64 %43, i64 %47)
store i32 %48, i32* %6
br label %59
49: ; preds = %33
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 2
%52 = load i8*, i8** %51
%53 = call i64 @atoi(i8* %52)
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call i64 @atoi(i8* %56)
%58 = call i32 @guess_itr(i64 %53, i64 %57)
store i32 %58, i32* %6
br label %59
59: ; preds = %49, %39
br label %60
60: ; preds = %59
%61 = load i32, i32* %6
%62 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %61)
store i32 0, i32* %3
br label %63
63: ; preds = %60, %31
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [3 x i8] c"-r\00"
@.str.1 = [3 x i8] c"-i\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [40 x i8] c"Your number is %d! Thanks for playing!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %9, %4
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i64 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call i64 @atoi(i8* %18)
%20 = icmp sgt i64 %16, %19
br i1 %20, label %21, label %23
21: ; preds = %13, %9, %2
%22 = load i32, i32* @EXIT_FAILURE
br label %38
23: ; preds = %13
%24 = load i8*, i8** %5
%25 = tail call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
%27 = load i8*, i8** %14
%28 = tail call i64 @atoi(i8* %27)
%29 = load i8*, i8** %17
%30 = tail call i64 @atoi(i8* %29)
br i1 %26, label %31, label %33
31: ; preds = %23
%32 = tail call i32 @guess_rec(i64 %28, i64 %30)
br label %35
33: ; preds = %23
%34 = tail call i32 @guess_itr(i64 %28, i64 %30)
br label %35
35: ; preds = %31, %33
%36 = phi i32 [ %32, %31 ], [ %34, %33 ]
%37 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %35, %21
%39 = phi i32 [ %22, %21 ], [ 0, %35 ]
ret i32 %39
}