#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 getch();
int /*<<< orphan*/ ungetch(int);
int skipspace() {
  int c;
  while ((c = getch()) == ' ' || c == '\t')
    ;
  if (c == '\n') {
    while ((c = getch()) == '\n')
      ;
    ungetch(c);
    return '\n';
  } else {
    return c;
  }
}


x86 assembly (clang, -O0):
<skipspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getch@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     114c <skipspace+0x2c>
cmpl   $0x9,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115c <skipspace+0x3c>
jmp    1161 <skipspace+0x41>
jmp    1128 <skipspace+0x8>
cmpl   $0xa,-0x8(%rbp)
jne    119c <skipspace+0x7c>
jmp    1170 <skipspace+0x50>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
jne    1188 <skipspace+0x68>
jmp    1170 <skipspace+0x50>
mov    -0x8(%rbp),%edi
call   1030 <ungetch@plt>
movl   $0xa,-0x4(%rbp)
jmp    11a2 <skipspace+0x82>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipspace>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getch@plt>
cmp    $0x9,%eax
je     1130 <skipspace+0x10>
cmp    $0x20,%eax
je     1130 <skipspace+0x10>
cmp    $0xa,%eax
jne    1168 <skipspace+0x48>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getch@plt>
cmp    $0xa,%eax
je     1150 <skipspace+0x30>
mov    %eax,%edi
call   1030 <ungetch@plt>
mov    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @skipspace() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %11, %0
%4 = call i32 (...) @getch()
store i32 %4, i32* %2
%5 = icmp eq i32 %4, 32
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 9
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ true, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %12
11: ; preds = %9
br label %3
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %23
15: ; preds = %12
br label %16
16: ; preds = %19, %15
%17 = call i32 (...) @getch()
store i32 %17, i32* %2
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %20
19: ; preds = %16
br label %16
20: ; preds = %16
%21 = load i32, i32* %2
%22 = call i32 @ungetch(i32 %21)
store i32 10, i32* %1
br label %25
23: ; preds = %12
%24 = load i32, i32* %2
store i32 %24, i32* %1
br label %25
25: ; preds = %23, %20
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
define i32 @skipspace() {
br label %1
1: ; preds = %3, %0
%2 = tail call i32 (...) @getch()
switch i32 %2, label %9 [
i32 32, label %3
i32 9, label %3
i32 10, label %4
]
3: ; preds = %1, %1
br label %1
4: ; preds = %1, %4
%5 = tail call i32 (...) @getch()
%6 = icmp eq i32 %5, 10
br i1 %6, label %4, label %7
7: ; preds = %4
%8 = tail call i32 @ungetch(i32 %5)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ 10, %7 ], [ %2, %1 ]
ret i32 %10
}