#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 EOF;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fgetc(int /*<<< orphan*/);
int getc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int c;
  if ((argc > 2) && (argv[1][0] == 'f')) {
    while ((c = fgetc(stdin)) != EOF)
      ;
  } else {
    while ((c = getc(stdin)) != EOF)
      ;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1193 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x66,%eax
jne    1193 <main+0x63>
jmp    1169 <main+0x39>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%eax
je     118e <main+0x5e>
jmp    1169 <main+0x39>
jmp    11c2 <main+0x92>
jmp    1198 <main+0x68>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e30(%rip),%rcx
cmp    (%rcx),%eax
je     11bd <main+0x8d>
jmp    1198 <main+0x68>
jmp    11c2 <main+0x92>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jle    1160 <main+0x30>
mov    0x8(%rsi),%rax
cmpb   $0x66,(%rax)
jne    1160 <main+0x30>
mov    0x2e9f(%rip),%r14
mov    0x2e90(%rip),%rbx
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%rbx),%eax
jne    1150 <main+0x20>
jmp    1179 <main+0x49>
xchg   %ax,%ax
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    0x2e6b(%rip),%rcx
cmp    (%rcx),%eax
jne    1160 <main+0x30>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %25
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 102
br i1 %16, label %17, label %25
17: ; preds = %9
br label %18
18: ; preds = %23, %17
%19 = load i32, i32* @stdin
%20 = call i32 @fgetc(i32 %19)
store i32 %20, i32* %6
%21 = load i32, i32* @EOF
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %18
br label %18
24: ; preds = %18
br label %33
25: ; preds = %9, %2
br label %26
26: ; preds = %31, %25
%27 = load i32, i32* @stdin
%28 = call i32 @getc(i32 %27)
store i32 %28, i32* %6
%29 = load i32, i32* @EOF
%30 = icmp ne i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %26
br label %26
32: ; preds = %26
br label %33
33: ; preds = %32, %24
%34 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %5, label %4
4: ; preds = %5, %2
br label %15
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 102
br i1 %9, label %10, label %4
10: ; preds = %5, %10
%11 = load i32, i32* @stdin
%12 = tail call i32 @fgetc(i32 %11)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %20, label %10
15: ; preds = %4, %15
%16 = load i32, i32* @stdin
%17 = tail call i32 @getc(i32 %16)
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %15
20: ; preds = %15, %10
%21 = tail call i32 @exit(i32 0)
unreachable
}