#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*/ append_file();
int /*<<< orphan*/ free_file();
int /*<<< orphan*/ read_file(char *);
int /*<<< orphan*/ write_file();
void stl_process(int argc, char **argv) {
  int i;
  if (!argc) {
  } else {
    for (i = 0; i < argc; i++) {
      read_file(argv[i]);
      append_file();
      free_file();
    }
    write_file();
  }
}


x86 assembly (clang, -O0):
<stl_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115e <stl_process+0x1e>
jmp    11a5 <stl_process+0x65>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119e <stl_process+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <read_file@plt>
mov    $0x0,%al
call   1030 <append_file@plt>
mov    $0x0,%al
call   1060 <free_file@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <stl_process+0x25>
mov    $0x0,%al
call   1040 <write_file@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stl_process>:
test   %edi,%edi
je     118c <stl_process+0x4c>
push   %r15
push   %r14
push   %rbx
jle    1180 <stl_process+0x40>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbx,8),%rdi
call   1050 <read_file@plt>
xor    %eax,%eax
call   1030 <append_file@plt>
xor    %eax,%eax
call   1060 <free_file@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <stl_process+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <write_file@plt>
ret

LLVM IR (-O0):
define void @stl_process(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %2
br label %28
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i8**, i8*** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @read_file(i8* %19)
%21 = call i32 (...) @append_file()
%22 = call i32 (...) @free_file()
br label %23
23: ; preds = %14
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %10
26: ; preds = %10
%27 = call i32 (...) @write_file()
br label %28
28: ; preds = %26, %8
ret void
}

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