#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(void) {
  char buf[2048];
  int geom_done = 0;
  while (fgets(buf, sizeof buf, stdin)) {
    if (!geom_done && !strncmp(buf, "\\usepackage[letter", 18)) {
      puts("\\usepackage[a4paper,body={6.07in,9.7in},"
           "top=.8in,left=1.1in]{geometry}");
      geom_done = 1;
    } else {
      fputs(buf, stdout);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x814(%rbp)
lea    -0x810(%rbp),%rdi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
mov    $0x800,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     11e3 <main+0xa3>
cmpl   $0x0,-0x814(%rbp)
jne    11c9 <main+0x89>
lea    -0x810(%rbp),%rdi
lea    0xe65(%rip),%rsi
mov    $0x12,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11c9 <main+0x89>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x814(%rbp)
jmp    11de <main+0x9e>
lea    -0x810(%rbp),%rdi
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    115c <main+0x1c>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    0x2e90(%rip),%r12
mov    (%r12),%edx
mov    %rsp,%rdi
mov    $0x800,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     11d9 <main+0x99>
xor    %ebp,%ebp
lea    0xe89(%rip),%r14
mov    %rsp,%rbx
lea    0xe92(%rip),%r15
mov    0x2e50(%rip),%r13
jmp    11b2 <main+0x72>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%esi
mov    %rbx,%rdi
call   1050 <fputs@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x800,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     11d9 <main+0x99>
test   %ebp,%ebp
jne    1190 <main+0x50>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x12,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1190 <main+0x50>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
jmp    119c <main+0x5c>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [19 x i8] c"\\usepackage[letter\00"
@.str.1 = [71 x i8] c"\\usepackage[a4paper,body={6.07in,9.7in},top=.8in,left=1.1in]{geometry}\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [2048 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %22, %0
%5 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i64 @fgets(i8* %5, i32 2048, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %4
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%14 = call i32 @strncmp(i8* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 18)
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @puts(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %22
18: ; preds = %12, %9
%19 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%20 = load i32, i32* @stdout
%21 = call i32 @fputs(i8* %19, i32 %20)
br label %22
22: ; preds = %18, %16
br label %4
23: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [19 x i8] c"\\usepackage[letter\00"
@.str.1 = [71 x i8] c"\\usepackage[a4paper,body={6.07in,9.7in},top=.8in,left=1.1in]{geometry}\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca [2048 x i8]
%2 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 2048, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %0, %17
%7 = phi i32 [ %18, %17 ], [ 0, %0 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = call i32 @strncmp(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 18)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0))
br label %17
14: ; preds = %9, %6
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* %2, i32 %15)
br label %17
17: ; preds = %14, %12
%18 = phi i32 [ %7, %14 ], [ 1, %12 ]
%19 = load i32, i32* @stdin
%20 = call i64 @fgets(i8* %2, i32 2048, i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %6
22: ; preds = %17, %0
ret i32 0
}