#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 */
char fio_getchar();
int fio_getint() {
  static int ret;
  static char ch;
  while ((ch = fio_getchar()) < '0' || ch > '9')
    ;
  ret = ch - '0';
  while ((ch = fio_getchar()) >= '0' && ch <= '9')
    ret = ret * 10 + ch - '0';
  return ret;
}


x86 assembly (clang, -O0):
<fio_getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
jmp    111d <fio_getint+0xd>
mov    $0x0,%al
call   1030 <fio_getchar@plt>
mov    %al,0x2f06(%rip)
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x1(%rbp)
jl     114b <fio_getint+0x3b>
movsbl 0x2eee(%rip),%eax
cmp    $0x39,%eax
setg   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
test   $0x1,%al
jne    115b <fio_getint+0x4b>
jmp    1160 <fio_getint+0x50>
jmp    111d <fio_getint+0xd>
movsbl 0x2ec9(%rip),%eax
sub    $0x30,%eax
mov    %eax,0x2ebc(%rip)
mov    $0x0,%al
call   1030 <fio_getchar@plt>
mov    %al,0x2eb3(%rip)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     119e <fio_getint+0x8e>
movsbl 0x2e9b(%rip),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    11ae <fio_getint+0x9e>
jmp    11cc <fio_getint+0xbc>
imul   $0xa,0x2e77(%rip),%eax
movsbl 0x2e74(%rip),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,0x2e65(%rip)
jmp    1170 <fio_getint+0x60>
mov    0x2e5a(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fio_getint>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <fio_getchar@plt>
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     1120 <fio_getint+0x10>
movzbl %al,%eax
add    $0xffffffd0,%eax
mov    %eax,0x2ef1(%rip)
xor    %eax,%eax
call   1030 <fio_getchar@plt>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1179 <fio_getint+0x69>
nopw   0x0(%rax,%rax,1)
movzbl %al,%eax
mov    0x2ed3(%rip),%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rax,%rcx,2),%eax
add    $0xffffffd0,%eax
mov    %eax,0x2ec4(%rip)
xor    %eax,%eax
call   1030 <fio_getchar@plt>
mov    %eax,%ecx
add    $0xd0,%cl
cmp    $0xa,%cl
jb     1150 <fio_getint+0x40>
mov    0x2ead(%rip),%eax
pop    %rcx
ret

LLVM IR (-O0):
@fio_getint.ret = internal global i32 0
@fio_getint.ch = internal global i8 0
define i32 @fio_getint() {
br label %1
1: ; preds = %11, %0
%2 = call signext i8 (...) @fio_getchar()
store i8 %2, i8* @fio_getint.ch
%3 = sext i8 %2 to i32
%4 = icmp slt i32 %3, 48
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load i8, i8* @fio_getint.ch
%7 = sext i8 %6 to i32
%8 = icmp sgt i32 %7, 57
br label %9
9: ; preds = %5, %1
%10 = phi i1 [ true, %1 ], [ %8, %5 ]
br i1 %10, label %11, label %12
11: ; preds = %9
br label %1
12: ; preds = %9
%13 = load i8, i8* @fio_getint.ch
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 48
store i32 %15, i32* @fio_getint.ret
br label %16
16: ; preds = %26, %12
%17 = call signext i8 (...) @fio_getchar()
store i8 %17, i8* @fio_getint.ch
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 48
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8, i8* @fio_getint.ch
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 57
br label %24
24: ; preds = %20, %16
%25 = phi i1 [ false, %16 ], [ %23, %20 ]
br i1 %25, label %26, label %33
26: ; preds = %24
%27 = load i32, i32* @fio_getint.ret
%28 = mul nsw i32 %27, 10
%29 = load i8, i8* @fio_getint.ch
%30 = sext i8 %29 to i32
%31 = add nsw i32 %28, %30
%32 = sub nsw i32 %31, 48
store i32 %32, i32* @fio_getint.ret
br label %16
33: ; preds = %24
%34 = load i32, i32* @fio_getint.ret
ret i32 %34
}

LLVM IR (-O2):
@fio_getint.ret = internal unnamed_addr global i32 0
define i32 @fio_getint() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @fio_getchar()
%3 = add i8 %2, -58
%4 = icmp ult i8 %3, -10
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = zext i8 %2 to i32
%7 = add nsw i32 %6, -48
store i32 %7, i32* @fio_getint.ret
%8 = tail call signext i8 (...) @fio_getchar()
%9 = add i8 %8, -48
%10 = icmp ult i8 %9, 10
br i1 %10, label %11, label %21
11: ; preds = %5, %11
%12 = phi i8 [ %18, %11 ], [ %8, %5 ]
%13 = zext i8 %12 to i32
%14 = load i32, i32* @fio_getint.ret
%15 = mul nsw i32 %14, 10
%16 = add nsw i32 %15, %13
%17 = add nsw i32 %16, -48
store i32 %17, i32* @fio_getint.ret
%18 = tail call signext i8 (...) @fio_getchar()
%19 = add i8 %18, -48
%20 = icmp ult i8 %19, 10
br i1 %20, label %11, label %21
21: ; preds = %11, %5
%22 = load i32, i32* @fio_getint.ret
ret i32 %22
}