#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__ deliver_file(char *, int);
int /*<<< orphan*/ exit(int);
int fileno(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int x = 0, fdout = 0;
  fdout = fileno(stdout);
  for (;;)
    for (x = 1; x < argc; x++) {
      if (deliver_file(argv[x], fdout))
        exit(1);
    }
}


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   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1030 <fileno@plt>
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b3 <main+0x83>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%esi
call   1040 <deliver_file@plt>
cmp    $0x0,%rax
je     11a0 <main+0x70>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11a5 <main+0x75>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <main+0x3c>
jmp    1165 <main+0x35>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1030 <fileno@plt>
mov    %eax,%r12d
mov    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x2,%r14d
jl     1160 <main+0x30>
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rdi
mov    %r12d,%esi
call   1040 <deliver_file@plt>
test   %rax,%rax
jne    118c <main+0x5c>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1170 <main+0x40>
jmp    1160 <main+0x30>
mov    $0x1,%edi
call   1050 <exit@plt>

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
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* @stdout
%9 = call i32 @fileno(i32 %8)
store i32 %9, i32* %7
br label %10
10: ; preds = %30, %2
store i32 1, i32* %6
br label %11
11: ; preds = %27, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %30
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = load i32, i32* %7
%22 = call i64 @deliver_file(i8* %20, i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %15
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %15
br label %27
27: ; preds = %26
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %11
30: ; preds = %11
br label %10
}

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