#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_double(struct tokenizer *, double *);
int /*<<< orphan*/ tok_err(struct tokenizer *, char *);
double get_double(struct tokenizer *t) {
  double x;
  if (!get_token(t))
    tok_err(t, "Unexpected end of file");
  if (!to_double(t, &x))
    tok_err(t, "Expected "
               "double");
  return x;
}


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

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

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