#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) {
  if (argc > 1)
    while (puts(argv[1]) != EOF)
      ;
  else
    while (puts("y") != EOF)
      ;
  err(1, "stdout");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    116c <main+0x4c>
jmp    1145 <main+0x25>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <puts@plt>
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%rax
je     1167 <main+0x47>
jmp    1145 <main+0x25>
jmp    1197 <main+0x77>
jmp    1171 <main+0x51>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%rax
je     1192 <main+0x72>
jmp    1171 <main+0x51>
jmp    1197 <main+0x77>
mov    $0x1,%edi
lea    0xe5f(%rip),%rsi
call   1040 <err@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    1150 <main+0x30>
mov    %rsi,%rbx
mov    0x2eb5(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x8(%rbx),%rdi
call   1030 <puts@plt>
cmp    (%r14),%rax
jne    1140 <main+0x20>
jmp    116d <main+0x4d>
lea    0xea9(%rip),%r14
mov    0x2e8a(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <puts@plt>
cmp    (%rbx),%rax
jne    1160 <main+0x40>
lea    0xe8e(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [2 x i8] c"y\00"
@.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 %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
br label %6
6: ; preds = %4, %6
%7 = load i8*, i8** %5
%8 = tail call i64 @puts(i8* dereferenceable(1) %7)
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
br i1 %10, label %15, label %6
11: ; preds = %2, %11
%12 = tail call i64 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %11
15: ; preds = %11, %6
%16 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}