#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc > 2) {
    fputs("Usage: yes [string]\n", stderr);
    return 1;
  } else if (argc == 1) {
    for (;;)
      puts("y");
  } else {
    for (++argv;;)
      puts(*argv);
  }
}


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   $0x2,-0x8(%rbp)
jle    1160 <main+0x40>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xeb0(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret
cmpl   $0x1,-0x8(%rbp)
jne    1180 <main+0x60>
jmp    116f <main+0x4f>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
jmp    116f <main+0x4f>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <puts@plt>
jmp    118c <main+0x6c>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jl     1142 <main+0x22>
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%eax
pop    %rbx
ret
cmp    $0x1,%edi
jne    115a <main+0x3a>
lea    0xec7(%rip),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1150 <main+0x30>
mov    %rsi,%rbx
nopl   (%rax)
mov    0x8(%rbx),%rdi
call   1030 <puts@plt>
jmp    1160 <main+0x40>

LLVM IR (-O0):
@.str = [21 x i8] c"Usage: yes [string]\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"y\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, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 1
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %11
br label %15
15: ; preds = %15, %14
%16 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %15
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i32 1
store i8** %19, i8*** %5
br label %20
20: ; preds = %20, %17
%21 = load i8**, i8*** %5
%22 = load i8*, i8** %21
%23 = call i32 @puts(i8* %22)
br label %20
}

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