#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 getchar_skipping_comments();
int getchar_update_lineno();
scalar_t__ isspace(int);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
void read_preprocessor_lines(void) {
  while (1) {
    int c;
    do {
      c = getchar_skipping_comments();
    } while (isspace(c));
    if (c != '#') {
      ungetc(c, stdin);
      break;
    }
    putchar(c);
    do {
      c = getchar_update_lineno();
      putchar(c);
    } while (c != '\n');
  }
}


x86 assembly (clang, -O0):
<read_preprocessor_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
jmp    115d <read_preprocessor_lines+0xd>
mov    $0x0,%al
call   1070 <getchar_skipping_comments@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
jne    115d <read_preprocessor_lines+0xd>
cmpl   $0x23,-0x4(%rbp)
je     1199 <read_preprocessor_lines+0x49>
mov    -0x4(%rbp),%edi
mov    0x2e5b(%rip),%rax
mov    (%rax),%esi
call   1050 <ungetc@plt>
jmp    11c2 <read_preprocessor_lines+0x72>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1060 <getchar_update_lineno@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0xa,-0x4(%rbp)
jne    11a1 <read_preprocessor_lines+0x51>
jmp    1158 <read_preprocessor_lines+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_preprocessor_lines>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <getchar_skipping_comments@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1160 <read_preprocessor_lines+0x10>
cmp    $0x23,%ebx
jne    11a7 <read_preprocessor_lines+0x57>
mov    $0x23,%edi
call   1030 <putchar@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <getchar_update_lineno@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <putchar@plt>
cmp    $0xa,%ebx
jne    1190 <read_preprocessor_lines+0x40>
jmp    1160 <read_preprocessor_lines+0x10>
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
pop    %rbx
jmp    1050 <ungetc@plt>

LLVM IR (-O0):
@stdin = global i32 0
define void @read_preprocessor_lines() {
%1 = alloca i32
br label %2
2: ; preds = %0, %26
br label %3
3: ; preds = %5, %2
%4 = call i32 (...) @getchar_skipping_comments()
store i32 %4, i32* %1
br label %5
5: ; preds = %3
%6 = load i32, i32* %1
%7 = call i64 @isspace(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %3, label %9
9: ; preds = %5
%10 = load i32, i32* %1
%11 = icmp ne i32 %10, 35
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %1
%14 = load i32, i32* @stdin
%15 = call i32 @ungetc(i32 %13, i32 %14)
br label %27
16: ; preds = %9
%17 = load i32, i32* %1
%18 = call i32 @putchar(i32 %17)
br label %19
19: ; preds = %23, %16
%20 = call i32 (...) @getchar_update_lineno()
store i32 %20, i32* %1
%21 = load i32, i32* %1
%22 = call i32 @putchar(i32 %21)
br label %23
23: ; preds = %19
%24 = load i32, i32* %1
%25 = icmp ne i32 %24, 10
br i1 %25, label %19, label %26
26: ; preds = %23
br label %2
27: ; preds = %12
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @read_preprocessor_lines() {
br label %1
1: ; preds = %5, %0
%2 = tail call i32 (...) @getchar_skipping_comments()
%3 = tail call i64 @isspace(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %10, %1
br label %1
6: ; preds = %1
%7 = icmp eq i32 %2, 35
br i1 %7, label %8, label %14
8: ; preds = %6
%9 = tail call i32 @putchar(i32 35)
br label %10
10: ; preds = %10, %8
%11 = tail call i32 (...) @getchar_update_lineno()
%12 = tail call i32 @putchar(i32 %11)
%13 = icmp eq i32 %11, 10
br i1 %13, label %5, label %10
14: ; preds = %6
%15 = load i32, i32* @stdin
%16 = tail call i32 @ungetc(i32 %2, i32 %15)
ret void
}