signed int pbm_getint(struct _IO_FILE$link2 *file) {
  char ch;
  signed int i;
  do
    ch = pbm_getc(file);
  while ((signed int)ch == 9 || (signed int)ch == 10 || (signed int)ch == 13 ||
         (signed int)ch == 32);
  i = 0;
  do {
    i = (i * 10 + (signed int)ch) - 48;
    ch = pbm_getc(file);
  } while ((signed int)ch <= 57 && (signed int)ch >= 48);
  return i;
}


x86 assembly (clang, -O0):
<pbm_getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <pbm_getc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x11(%rbp)
je     116d <pbm_getint+0x5d>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x11(%rbp)
je     116d <pbm_getint+0x5d>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x11(%rbp)
je     116d <pbm_getint+0x5d>
movsbl -0x9(%rbp),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    111c <pbm_getint+0xc>
movl   $0x0,-0x10(%rbp)
imul   $0xa,-0x10(%rbp),%eax
movsbl -0x9(%rbp),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <pbm_getc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x39,%ecx
mov    %al,-0x12(%rbp)
jg     11bc <pbm_getint+0xac>
movsbl -0x9(%rbp),%eax
cmp    $0x30,%eax
setge  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    117f <pbm_getint+0x6f>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pbm_getint>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <pbm_getc@plt>
mov    %eax,%ecx
and    $0xfb,%ecx
cmp    $0x9,%ecx
je     1120 <pbm_getint+0x10>
mov    %eax,%ecx
shl    $0x18,%ecx
cmp    $0xa000000,%ecx
je     1120 <pbm_getint+0x10>
cmp    $0x20000000,%ecx
je     1120 <pbm_getint+0x10>
xor    %ebx,%ebx
xchg   %ax,%ax
lea    (%rbx,%rbx,4),%ecx
movsbl %al,%eax
lea    (%rax,%rcx,2),%ebx
add    $0xffffffd0,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <pbm_getc@plt>
mov    %eax,%ecx
shl    $0x18,%ecx
add    $0xd0ffffff,%ecx
cmp    $0xaffffff,%ecx
jb     1150 <pbm_getint+0x40>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%"struct._IO_FILE$link2" = type opaque
define i32 @pbm_getint(%"struct._IO_FILE$link2"* %0) {
%2 = alloca %"struct._IO_FILE$link2"*
%3 = alloca i8
%4 = alloca i32
store %"struct._IO_FILE$link2"* %0, %"struct._IO_FILE$link2"** %2
br label %5
5: ; preds = %25, %1
%6 = load %"struct._IO_FILE$link2"*, %"struct._IO_FILE$link2"** %2
%7 = call i32 (%"struct._IO_FILE$link2"*, ...) bitcast (i32 (...)* @pbm_getc to i32 (%"struct._IO_FILE$link2"*, ...)*)(%"struct._IO_FILE$link2"* %6)
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
br label %9
9: ; preds = %5
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 9
br i1 %12, label %25, label %13
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 10
br i1 %16, label %25, label %17
17: ; preds = %13
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 13
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br label %25
25: ; preds = %21, %17, %13, %9
%26 = phi i1 [ true, %17 ], [ true, %13 ], [ true, %9 ], [ %24, %21 ]
br i1 %26, label %5, label %27
27: ; preds = %25
store i32 0, i32* %4
br label %28
28: ; preds = %46, %27
%29 = load i32, i32* %4
%30 = mul nsw i32 %29, 10
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = add nsw i32 %30, %32
%34 = sub nsw i32 %33, 48
store i32 %34, i32* %4
%35 = load %"struct._IO_FILE$link2"*, %"struct._IO_FILE$link2"** %2
%36 = call i32 (%"struct._IO_FILE$link2"*, ...) bitcast (i32 (...)* @pbm_getc to i32 (%"struct._IO_FILE$link2"*, ...)*)(%"struct._IO_FILE$link2"* %35)
%37 = trunc i32 %36 to i8
store i8 %37, i8* %3
br label %38
38: ; preds = %28
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 57
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = load i8, i8* %3
%44 = sext i8 %43 to i32
%45 = icmp sge i32 %44, 48
br label %46
46: ; preds = %42, %38
%47 = phi i1 [ false, %38 ], [ %45, %42 ]
br i1 %47, label %28, label %48
48: ; preds = %46
%49 = load i32, i32* %4
ret i32 %49
}

LLVM IR (-O2):
%"struct._IO_FILE$link2" = type opaque
define i32 @pbm_getint(%"struct._IO_FILE$link2"* %0) {
br label %2
2: ; preds = %7, %1
%3 = tail call i32 (%"struct._IO_FILE$link2"*, ...) bitcast (i32 (...)* @pbm_getc to i32 (%"struct._IO_FILE$link2"*, ...)*)(%"struct._IO_FILE$link2"* %0)
%4 = freeze i32 %3
%5 = and i32 %4, 251
%6 = icmp eq i32 %5, 9
br i1 %6, label %7, label %8
7: ; preds = %2, %8, %8
br label %2
8: ; preds = %2
%9 = shl i32 %4, 24
switch i32 %9, label %10 [
i32 536870912, label %7
i32 167772160, label %7
]
10: ; preds = %8
%11 = freeze i32 %3
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ %20, %12 ], [ %11, %10 ]
%14 = phi i32 [ %19, %12 ], [ 0, %10 ]
%15 = mul nsw i32 %14, 10
%16 = shl i32 %13, 24
%17 = ashr exact i32 %16, 24
%18 = add nsw i32 %17, -48
%19 = add i32 %18, %15
%20 = tail call i32 (%"struct._IO_FILE$link2"*, ...) bitcast (i32 (...)* @pbm_getc to i32 (%"struct._IO_FILE$link2"*, ...)*)(%"struct._IO_FILE$link2"* %0)
%21 = shl i32 %20, 24
%22 = add i32 %21, -788529153
%23 = icmp ult i32 %22, 184549375
br i1 %23, label %12, label %24
24: ; preds = %12
ret i32 %19
}