#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 fwrite(char *, scalar_t__, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++)
    if (fwrite(argv[i], strlen(argv[i]) + 1, 1, stdout) != 1)
      return 1;
  return 0;
}


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)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x90>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
mov    0x2e64(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1040 <fwrite@plt>
cmp    $0x1,%eax
je     119d <main+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <main+0x97>
jmp    11a2 <main+0x82>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     117f <main+0x5f>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebp
mov    0x2e9e(%rip),%r13
mov    $0x1,%r12d
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
mov    0x0(%r13),%ecx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <fwrite@plt>
cmp    $0x1,%eax
jne    1182 <main+0x62>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1150 <main+0x30>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %7
7: ; preds = %29, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %32
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i64 @strlen(i8* %21)
%23 = add nsw i64 %22, 1
%24 = load i32, i32* @stdout
%25 = call i32 @fwrite(i8* %16, i64 %23, i32 1, i32 %24)
%26 = icmp ne i32 %25, 1
br i1 %26, label %27, label %28
27: ; preds = %11
store i32 1, i32* %3
br label %33
28: ; preds = %11
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %7
32: ; preds = %7
store i32 0, i32* %3
br label %33
33: ; preds = %32, %27
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %17, %5
br i1 %7, label %18, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 1, %4 ], [ %17, %6 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strlen(i8* dereferenceable(1) %11)
%13 = add nsw i64 %12, 1
%14 = load i32, i32* @stdout
%15 = tail call i32 @fwrite(i8* %11, i64 %13, i32 1, i32 %14)
%16 = icmp eq i32 %15, 1
%17 = add nuw nsw i64 %9, 1
br i1 %16, label %6, label %18
18: ; preds = %6, %8, %2
%19 = phi i32 [ 0, %2 ], [ 1, %8 ], [ 0, %6 ]
ret i32 %19
}