#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 */
struct tokenizer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ get_token(struct tokenizer *);
int /*<<< orphan*/ to_int(struct tokenizer *, int *);
int /*<<< orphan*/ tok_err(struct tokenizer *, char *);
int get_int(struct tokenizer *t) {
  int x;
  if (!get_token(t))
    tok_err(t, "Unexpected end of file");
  if (!to_int(t, &x))
    tok_err(t, "Expected "
               "int");
  return x;
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_token@plt>
cmp    $0x0,%eax
jne    115e <get_int+0x2e>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <tok_err@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <to_int@plt>
cmp    $0x0,%eax
jne    1184 <get_int+0x54>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <tok_err@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1050 <get_token@plt>
test   %eax,%eax
jne    1150 <get_int+0x20>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <tok_err@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <to_int@plt>
test   %eax,%eax
jne    1170 <get_int+0x40>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <tok_err@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tokenizer = type { i32 }
@.str = [23 x i8] c"Unexpected end of file\00"
@.str.1 = [13 x i8] c"Expected int\00"
define i32 @get_int(%struct.tokenizer* %0) {
%2 = alloca %struct.tokenizer*
%3 = alloca i32
store %struct.tokenizer* %0, %struct.tokenizer** %2
%4 = load %struct.tokenizer*, %struct.tokenizer** %2
%5 = call i32 @get_token(%struct.tokenizer* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load %struct.tokenizer*, %struct.tokenizer** %2
%9 = call i32 @tok_err(%struct.tokenizer* %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %1
%11 = load %struct.tokenizer*, %struct.tokenizer** %2
%12 = call i32 @to_int(%struct.tokenizer* %11, i32* %3)
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load %struct.tokenizer*, %struct.tokenizer** %2
%16 = call i32 @tok_err(%struct.tokenizer* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
%struct.tokenizer = type { i32 }
@.str = [23 x i8] c"Unexpected end of file\00"
@.str.1 = [13 x i8] c"Expected int\00"
define i32 @get_int(%struct.tokenizer* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @get_token(%struct.tokenizer* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @tok_err(%struct.tokenizer* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = call i32 @to_int(%struct.tokenizer* %0, i32* %2)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @tok_err(%struct.tokenizer* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %2
ret i32 %14
}