#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;
int EXIT_SUCCESS;
long LONG_MAX;
int /*<<< orphan*/ cheat_print_definitions(size_t);
long strtol(char *, int /*<<< orphan*/ *, int);
int main(int const count, char **const arguments) {
  long int index;
  if (count != 2)
    return EXIT_FAILURE;
  index = strtol(arguments[1], NULL, 10);
  if (index < 1 || index == LONG_MAX)
    return EXIT_FAILURE;
  (void)cheat_print_definitions((size_t)index);
  return EXIT_SUCCESS;
}


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     1151 <main+0x31>
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jl     118a <main+0x6a>
mov    -0x18(%rbp),%rax
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%rax
jne    119b <main+0x7b>
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b0 <main+0x90>
mov    -0x18(%rbp),%rdi
call   1040 <cheat_print_definitions@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb0(%rip),%rbx
cmp    $0x2,%edi
jne    115d <main+0x3d>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
test   %rax,%rax
jle    115d <main+0x3d>
mov    0x2e97(%rip),%rcx
cmp    (%rcx),%rax
je     115d <main+0x3d>
mov    %rax,%rdi
call   1040 <cheat_print_definitions@plt>
mov    0x2e73(%rip),%rbx
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@LONG_MAX = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
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, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* @EXIT_FAILURE
store i32 %10, i32* %3
br label %28
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strtol(i8* %14, i32* null, i32 10)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = icmp slt i64 %16, 1
br i1 %17, label %22, label %18
18: ; preds = %11
%19 = load i64, i64* %6
%20 = load i64, i64* @LONG_MAX
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18, %11
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %3
br label %28
24: ; preds = %18
%25 = load i64, i64* %6
%26 = call i32 @cheat_print_definitions(i64 %25)
%27 = load i32, i32* @EXIT_SUCCESS
store i32 %27, i32* %3
br label %28
28: ; preds = %24, %22, %9
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@LONG_MAX = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strtol(i8* nocapture %6, i32* null, i32 10)
%8 = icmp slt i64 %7, 1
%9 = load i64, i64* @LONG_MAX
%10 = icmp eq i64 %7, %9
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %14, label %12
12: ; preds = %4
%13 = tail call i32 @cheat_print_definitions(i64 %7)
br label %14
14: ; preds = %4, %2, %12
%15 = phi i32* [ @EXIT_SUCCESS, %12 ], [ @EXIT_FAILURE, %2 ], [ @EXIT_FAILURE, %4 ]
%16 = load i32, i32* %15
ret i32 %16
}