#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*/ O_RDONLY;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ concatenate(int /*<<< orphan*/);
int /*<<< orphan*/ open(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argc == 1)
    concatenate(STDIN_FILENO);
  while (*argv)
    concatenate(open(*++argv, O_RDONLY));
  return 0;
}


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)
jne    114e <main+0x2e>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1030 <concatenate@plt>
jmp    1153 <main+0x33>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     118e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,%edi
call   1030 <concatenate@plt>
jmp    1153 <main+0x33>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jne    113a <main+0x1a>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <concatenate@plt>
cmpq   $0x0,(%rbx)
je     116c <main+0x4c>
add    $0x8,%rbx
mov    0x2e9d(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
mov    (%r14),%esi
call   1040 <open@plt>
mov    %eax,%edi
call   1030 <concatenate@plt>
cmpq   $0x0,(%rbx)
lea    0x8(%rbx),%rbx
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@O_RDONLY = global i32 0
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 eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @STDIN_FILENO
%10 = call i32 @concatenate(i32 %9)
br label %11
11: ; preds = %8, %2
br label %12
12: ; preds = %16, %11
%13 = load i8**, i8*** %5
%14 = load i8*, i8** %13
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
%19 = load i8*, i8** %18
%20 = load i32, i32* @O_RDONLY
%21 = call i32 @open(i8* %19, i32 %20)
%22 = call i32 @concatenate(i32 %21)
br label %12
23: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @STDIN_FILENO
%6 = tail call i32 @concatenate(i32 %5)
br label %7
7: ; preds = %4, %2
%8 = load i8*, i8** %1
%9 = icmp eq i8* %8, null
br i1 %9, label %19, label %10
10: ; preds = %7, %10
%11 = phi i8** [ %12, %10 ], [ %1, %7 ]
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i32, i32* @O_RDONLY
%15 = tail call i32 @open(i8* %13, i32 %14)
%16 = tail call i32 @concatenate(i32 %15)
%17 = load i8*, i8** %12
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %10
19: ; preds = %10, %7
ret i32 0
}