#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 getchar();
scalar_t__ isblank(char);
char get_first(void) {
  char ch;
  while ((ch = getchar()) && isblank(ch) || ch == '\n')
    continue;
  while (getchar() != '\n')
    continue;
  return ch;
}


x86 assembly (clang, -O0):
<get_first>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1159 <get_first+0x39>
movsbl -0x1(%rbp),%edi
call   1030 <isblank@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1166 <get_first+0x46>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1176 <get_first+0x56>
jmp    117b <get_first+0x5b>
jmp    1128 <get_first+0x8>
jmp    1180 <get_first+0x60>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1198 <get_first+0x78>
jmp    1180 <get_first+0x60>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_first>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
test   %al,%al
je     1150 <get_first+0x30>
movsbl %bl,%edi
call   1030 <isblank@plt>
cmp    $0xa,%bl
je     1130 <get_first+0x10>
test   %rax,%rax
jne    1130 <get_first+0x10>
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1150 <get_first+0x30>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @get_first() {
%1 = alloca i8
br label %2
2: ; preds = %16, %0
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i8, i8* %1
%8 = call i64 @isblank(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6, %2
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 10
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ true, %6 ], [ %13, %10 ]
br i1 %15, label %16, label %17
16: ; preds = %14
br label %2
17: ; preds = %14
br label %18
18: ; preds = %22, %17
%19 = call signext i8 (...) @getchar()
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 10
br i1 %21, label %22, label %23
22: ; preds = %18
br label %18
23: ; preds = %18
%24 = load i8, i8* %1
ret i8 %24
}

LLVM IR (-O2):
define signext i8 @get_first() {
br label %1
1: ; preds = %4, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i64 @isblank(i8 signext %2)
%6 = icmp ne i64 %5, 0
%7 = icmp eq i8 %2, 10
%8 = or i1 %7, %6
br i1 %8, label %1, label %9
9: ; preds = %4, %1
br label %10
10: ; preds = %9, %10
%11 = tail call signext i8 (...) @getchar()
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %10
13: ; preds = %10
ret i8 %2
}