#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_ulong(struct tokenizer *, unsigned long *);
int /*<<< orphan*/ tok_err(struct tokenizer *, char *);
unsigned long int get_ulong(struct tokenizer *t) {
  unsigned long int x;
  if (!get_token(t))
    tok_err(t, "Unexpected end of file");
  if (!to_ulong(t, &x))
    tok_err(t, "Expected "
               "ulong");
  return x;
}


x86 assembly (clang, -O0):
<get_ulong>:
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_ulong+0x2e>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <tok_err@plt>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <to_ulong@plt>
cmp    $0x0,%eax
jne    1184 <get_ulong+0x54>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <tok_err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ulong>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1050 <get_token@plt>
test   %eax,%eax
jne    1150 <get_ulong+0x20>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <tok_err@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <to_ulong@plt>
test   %eax,%eax
jne    1170 <get_ulong+0x40>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <tok_err@plt>
mov    0x8(%rsp),%rax
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 = [15 x i8] c"Expected ulong\00"
define i64 @get_ulong(%struct.tokenizer* %0) {
%2 = alloca %struct.tokenizer*
%3 = alloca i64
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_ulong(%struct.tokenizer* %11, i64* %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 ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %14, %10
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
%struct.tokenizer = type { i32 }
@.str = [23 x i8] c"Unexpected end of file\00"
@.str.1 = [15 x i8] c"Expected ulong\00"
define i64 @get_ulong(%struct.tokenizer* %0) {
%2 = alloca i64
%3 = bitcast i64* %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_ulong(%struct.tokenizer* %0, i64* %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 ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load i64, i64* %2
ret i64 %14
}