#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__ EOF;
int /*<<< orphan*/ err(int, char *);
scalar_t__ puts(char *);
int main(int argc, char **argv) {
  char *output = "n";
  if (argc > 1)
    output = argv[1];
  while (puts(output) != EOF)
    ;
  err(1, "stdout");
}


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)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1157 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    115c <main+0x3c>
mov    -0x18(%rbp),%rdi
call   1030 <puts@plt>
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%rax
je     117a <main+0x5a>
jmp    115c <main+0x3c>
mov    $0x1,%edi
lea    0xe7c(%rip),%rsi
call   1040 <err@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     112f <main+0xf>
mov    0x8(%rsi),%rbx
jmp    1136 <main+0x16>
lea    0xeca(%rip),%rbx
mov    0x2eab(%rip),%r14
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
cmp    (%r14),%rax
jne    1140 <main+0x20>
lea    0xeae(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"n\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"stdout\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
br label %13
13: ; preds = %9, %2
br label %14
14: ; preds = %19, %13
%15 = load i8*, i8** %6
%16 = call i64 @puts(i8* %15)
%17 = load i64, i64* @EOF
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %14
br label %14
20: ; preds = %14
%21 = call i32 @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [2 x i8] c"n\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"stdout\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %4, %2
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
br label %9
9: ; preds = %9, %7
%10 = tail call i64 @puts(i8* dereferenceable(1) %8)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %9
13: ; preds = %9
%14 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}