#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 EOF;
char getch();
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/);
int getop() {
  char ch;
  while ((ch = getch()) == ' ' || ch == '\t')
    ;
  if (!isdigit(ch) && ch != '.') {
    return ch;
  }
  if (ch != EOF) {
    ungetc(ch, stdin);
  }
  return '0';
}


x86 assembly (clang, -O0):
<getop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x6(%rbp)
je     1160 <getop+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
test   $0x1,%al
jne    1170 <getop+0x40>
jmp    1175 <getop+0x45>
jmp    1138 <getop+0x8>
movsbl -0x5(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11a0 <getop+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x2e,%eax
je     11a0 <getop+0x70>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d1 <getop+0xa1>
movsbl -0x5(%rbp),%eax
mov    0x2e35(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ca <getop+0x9a>
mov    -0x5(%rbp),%al
mov    0x2e28(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1040 <ungetc@plt>
movl   $0x30,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getop>:
push   %rbp
push   %rbx
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0x9,%al
je     1140 <getop+0x10>
mov    %eax,%ebx
cmp    $0x20,%al
je     1140 <getop+0x10>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1164 <getop+0x34>
cmp    $0x2e,%bl
jne    1185 <getop+0x55>
mov    0x2e75(%rip),%rax
mov    $0x30,%ebp
cmp    (%rax),%bl
je     1185 <getop+0x55>
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
movsbl %bl,%edi
call   1040 <ungetc@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
@stdin = global i32 0
define i32 @getop() {
%1 = alloca i32
%2 = alloca i8
br label %3
3: ; preds = %13, %0
%4 = call signext i8 (...) @getch()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 32
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 9
br label %11
11: ; preds = %7, %3
%12 = phi i1 [ true, %3 ], [ %10, %7 ]
br i1 %12, label %13, label %14
13: ; preds = %11
br label %3
14: ; preds = %11
%15 = load i8, i8* %2
%16 = call i32 @isdigit(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 46
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
store i32 %24, i32* %1
br label %36
25: ; preds = %18, %14
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = load i8, i8* @EOF
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %27, %29
br i1 %30, label %31, label %35
31: ; preds = %25
%32 = load i8, i8* %2
%33 = load i32, i32* @stdin
%34 = call i32 @ungetc(i8 signext %32, i32 %33)
br label %35
35: ; preds = %31, %25
store i32 48, i32* %1
br label %36
36: ; preds = %35, %22
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@EOF = global i8 0
@stdin = global i32 0
define i32 @getop() {
br label %1
1: ; preds = %3, %0
%2 = tail call signext i8 (...) @getch()
switch i8 %2, label %4 [
i8 32, label %3
i8 9, label %3
]
3: ; preds = %1, %1
br label %1
4: ; preds = %1
%5 = sext i8 %2 to i32
%6 = tail call i32 @isdigit(i8 signext %2)
%7 = icmp eq i32 %6, 0
%8 = icmp ne i8 %2, 46
%9 = select i1 %7, i1 %8, i1 false
br i1 %9, label %16, label %10
10: ; preds = %4
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %2, %11
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* @stdin
%15 = tail call i32 @ungetc(i8 signext %2, i32 %14)
br label %16
16: ; preds = %10, %13, %4
%17 = phi i32 [ %5, %4 ], [ 48, %13 ], [ 48, %10 ]
ret i32 %17
}