#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 /*<<< orphan*/ decode_line(unsigned char *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(unsigned char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
scalar_t__ strstr(unsigned char *, char *);
main() {
  unsigned char buf[256];
  int format = 0;
  while (1) {
    if (fgets(buf, 255, stdin) == NULL)
      break;
    if (buf[0] == '\n' || buf[0] == 0)
      format = 0;
    if (buf[0] == '#' && strstr(buf, "c-format"))
      format = 1;
    decode_line(buf, format);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
jne    1185 <main+0x45>
jmp    11fd <main+0xbd>
movzbl -0x110(%rbp),%eax
cmp    $0xa,%eax
je     11a5 <main+0x65>
movzbl -0x110(%rbp),%eax
cmp    $0x0,%eax
jne    11af <main+0x6f>
movl   $0x0,-0x114(%rbp)
movzbl -0x110(%rbp),%eax
cmp    $0x23,%eax
jne    11e6 <main+0xa6>
lea    -0x110(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11e6 <main+0xa6>
movl   $0x1,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x114(%rbp),%esi
call   1050 <decode_line@plt>
jmp    115c <main+0x1c>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    0x2e90(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0xff,%esi
call   1030 <fgets@plt>
test   %rax,%rax
jne    1174 <main+0x34>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %ebx,%ebx
mov    %rsp,%r13
lea    0xe80(%rip),%r14
mov    $0x1,%r12d
jmp    11b3 <main+0x73>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%ebp
mov    %r13,%rdi
mov    %ebp,%esi
call   1050 <decode_line@plt>
mov    (%r15),%edx
mov    %r13,%rdi
mov    $0xff,%esi
call   1030 <fgets@plt>
mov    %ebp,%ebx
test   %rax,%rax
je     116d <main+0x2d>
movzbl (%rsp),%eax
mov    $0x0,%ebp
test   %al,%al
je     1192 <main+0x52>
mov    $0x0,%ebp
cmp    $0xa,%al
je     1192 <main+0x52>
cmp    $0x23,%al
jne    1190 <main+0x50>
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <strstr@plt>
test   %rax,%rax
cmovne %r12d,%ebx
jmp    1190 <main+0x50>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [9 x i8] c"c-format\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %0, %31
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %5, i32 255, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %4
br label %35
10: ; preds = %4
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 10
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15, %10
store i32 0, i32* %3
br label %21
21: ; preds = %20, %15
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = icmp eq i32 %24, 35
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%28 = call i64 @strstr(i8* %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 1, i32* %3
br label %31
31: ; preds = %30, %26, %21
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%33 = load i32, i32* %3
%34 = call i32 @decode_line(i8* %32, i32 %33)
br label %4
35: ; preds = %9
%36 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [9 x i8] c"c-format\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32* @fgets(i8* %2, i32 255, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %20, label %6
6: ; preds = %0, %14
%7 = phi i32 [ %15, %14 ], [ 0, %0 ]
%8 = load i8, i8* %2
switch i8 %8, label %13 [
i8 10, label %14
i8 0, label %14
i8 35, label %9
]
9: ; preds = %6
%10 = call i64 @strstr(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i32 %7, i32 1
br label %14
13: ; preds = %6
br label %14
14: ; preds = %6, %6, %13, %9
%15 = phi i32 [ %12, %9 ], [ 0, %6 ], [ 0, %6 ], [ %7, %13 ]
%16 = call i32 @decode_line(i8* %2, i32 %15)
%17 = load i32, i32* @stdin
%18 = call i32* @fgets(i8* %2, i32 255, i32 %17)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %6
20: ; preds = %14, %0
%21 = call i32 @exit(i32 0)
unreachable
}