#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 get();
char peek();
int number() {
  int result = get() - '0';
  while (peek() >= '0' && peek() <= '9') {
    result = 10 * result + get() - '0';
  }
  return result;
}


x86 assembly (clang, -O0):
<number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get@plt>
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x5(%rbp)
jl     1160 <number+0x40>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1170 <number+0x50>
jmp    1190 <number+0x70>
imul   $0xa,-0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <get@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <number+0x15>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number>:
push   %rbx
xor    %eax,%eax
call   1040 <get@plt>
mov    %eax,%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x30,%al
jl     1166 <number+0x46>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x39,%al
jg     1166 <number+0x46>
lea    (%rbx,%rbx,4),%ebx
xor    %eax,%eax
call   1040 <get@plt>
lea    (%rax,%rbx,2),%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x2f,%al
jg     1140 <number+0x20>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @number() {
%1 = alloca i32
%2 = call i32 (...) @get()
%3 = sub nsw i32 %2, 48
store i32 %3, i32* %1
br label %4
4: ; preds = %14, %0
%5 = call signext i8 (...) @peek()
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 48
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = call signext i8 (...) @peek()
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 57
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ false, %4 ], [ %11, %8 ]
br i1 %13, label %14, label %20
14: ; preds = %12
%15 = load i32, i32* %1
%16 = mul nsw i32 10, %15
%17 = call i32 (...) @get()
%18 = add nsw i32 %16, %17
%19 = sub nsw i32 %18, 48
store i32 %19, i32* %1
br label %4
20: ; preds = %12
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @number() {
%1 = tail call i32 (...) @get()
%2 = add nsw i32 %1, -48
%3 = tail call signext i8 (...) @peek()
%4 = icmp sgt i8 %3, 47
br i1 %4, label %5, label %16
5: ; preds = %0, %9
%6 = phi i32 [ %13, %9 ], [ %2, %0 ]
%7 = tail call signext i8 (...) @peek()
%8 = icmp slt i8 %7, 58
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = mul nsw i32 %6, 10
%11 = tail call i32 (...) @get()
%12 = add nsw i32 %11, %10
%13 = add nsw i32 %12, -48
%14 = tail call signext i8 (...) @peek()
%15 = icmp sgt i8 %14, 47
br i1 %15, label %5, label %16
16: ; preds = %5, %9, %0
%17 = phi i32 [ %2, %0 ], [ %13, %9 ], [ %6, %5 ]
ret i32 %17
}