#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*/ fwrite(char *, int, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  char *output;
  int output_size;
  int output_len;
  if (argc > 1) {
    int needed_size = 2 + strlen(argv[1]);
    for (int i = 2; i < argc; i++) {
      needed_size += 1 + strlen(argv[i]);
    }
    output = (char *)malloc(needed_size);
    strcat(output, argv[1]);
    for (int i = 2; i < argc; i++) {
      strcat(output, " ");
      strcat(output, argv[i]);
    }
    strcat(output, "\n");
    output_len = strlen(output);
  } else {
    output = "y\n";
    output_len = 2;
  }
  for (;;)
    fwrite(output, 1, output_len, stdout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1232 <main+0xf2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ae <main+0x6e>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117a <main+0x3a>
mov    -0x24(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1050 <strcat@plt>
movl   $0x2,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1211 <main+0xd1>
mov    -0x18(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <strcat@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11d2 <main+0x92>
mov    -0x18(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
jmp    1244 <main+0x104>
lea    0xdc9(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x2,-0x20(%rbp)
jmp    1249 <main+0x109>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    0x2d89(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1060 <fwrite@plt>
jmp    1249 <main+0x109>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11fb <main+0xbb>
mov    %rsi,%r14
mov    %edi,%r15d
mov    0x8(%rsi),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
add    $0x2,%ebx
mov    %r15d,%r12d
cmp    $0x2,%r15d
je     1197 <main+0x57>
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
add    $0x1,%ebx
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1180 <main+0x40>
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    0x8(%r14),%rsi
mov    %rax,%rdi
call   1050 <strcat@plt>
cmp    $0x3,%r15d
jl     11e0 <main+0xa0>
mov    $0x2,%ebp
lea    0xe41(%rip),%r15
nop
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    (%r14,%rbp,8),%rsi
mov    %r13,%rdi
call   1050 <strcat@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11c0 <main+0x80>
lea    0xe1c(%rip),%rsi
mov    %r13,%rdi
call   1050 <strcat@plt>
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
jmp    1207 <main+0xc7>
mov    $0x2,%ebp
lea    0xdfb(%rip),%r13
mov    0x2dd2(%rip),%rbx
xchg   %ax,%ax
mov    (%rbx),%ecx
mov    %r13,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
call   1060 <fwrite@plt>
jmp    1210 <main+0xd0>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"y\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %68
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strlen(i8* %17)
%19 = add nsw i32 2, %18
store i32 %19, i32* %9
store i32 2, i32* %10
br label %20
20: ; preds = %34, %14
%21 = load i32, i32* %10
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @strlen(i8* %29)
%31 = add nsw i32 1, %30
%32 = load i32, i32* %9
%33 = add nsw i32 %32, %31
store i32 %33, i32* %9
br label %34
34: ; preds = %24
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %20
37: ; preds = %20
%38 = load i32, i32* %9
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to i8*
store i8* %40, i8** %6
%41 = load i8*, i8** %6
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @strcat(i8* %41, i8* %44)
store i32 2, i32* %11
br label %46
46: ; preds = %60, %37
%47 = load i32, i32* %11
%48 = load i32, i32* %4
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %63
50: ; preds = %46
%51 = load i8*, i8** %6
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%53 = load i8*, i8** %6
%54 = load i8**, i8*** %5
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @strcat(i8* %53, i8* %58)
br label %60
60: ; preds = %50
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
br label %46
63: ; preds = %46
%64 = load i8*, i8** %6
%65 = call i32 @strcat(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%66 = load i8*, i8** %6
%67 = call i32 @strlen(i8* %66)
store i32 %67, i32* %8
br label %69
68: ; preds = %2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %6
store i32 2, i32* %8
br label %69
69: ; preds = %68, %63
br label %70
70: ; preds = %70, %69
%71 = load i8*, i8** %6
%72 = load i32, i32* %8
%73 = load i32, i32* @stdout
%74 = call i32 @fwrite(i8* %71, i32 1, i32 %72, i32 %73)
br label %70
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"y\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %42
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, 2
%9 = icmp eq i32 %0, 2
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = zext i32 %0 to i64
br label %21
12: ; preds = %21, %4
%13 = phi i32 [ %8, %4 ], [ %28, %21 ]
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8*
%16 = load i8*, i8** %5
%17 = tail call i32 @strcat(i8* %15, i8* %16)
%18 = icmp sgt i32 %0, 2
br i1 %18, label %19, label %31
19: ; preds = %12
%20 = zext i32 %0 to i64
br label %34
21: ; preds = %10, %21
%22 = phi i64 [ 2, %10 ], [ %29, %21 ]
%23 = phi i32 [ %8, %10 ], [ %28, %21 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 %22
%25 = load i8*, i8** %24
%26 = tail call i32 @strlen(i8* %25)
%27 = add i32 %23, 1
%28 = add i32 %27, %26
%29 = add nuw nsw i64 %22, 1
%30 = icmp eq i64 %29, %11
br i1 %30, label %12, label %21
31: ; preds = %34, %12
%32 = tail call i32 @strcat(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = tail call i32 @strlen(i8* %15)
br label %42
34: ; preds = %19, %34
%35 = phi i64 [ 2, %19 ], [ %40, %34 ]
%36 = tail call i32 @strcat(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%37 = getelementptr inbounds i8*, i8** %1, i64 %35
%38 = load i8*, i8** %37
%39 = tail call i32 @strcat(i8* %15, i8* %38)
%40 = add nuw nsw i64 %35, 1
%41 = icmp eq i64 %40, %20
br i1 %41, label %31, label %34
42: ; preds = %2, %31
%43 = phi i8* [ %15, %31 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %2 ]
%44 = phi i32 [ %33, %31 ], [ 2, %2 ]
br label %45
45: ; preds = %45, %42
%46 = load i32, i32* @stdout
%47 = tail call i32 @fwrite(i8* %43, i32 1, i32 %44, i32 %46)
br label %45
}