#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ openFile(int /*<<< orphan*/ **, int /*<<< orphan*/ **);
int /*<<< orphan*/ processCommands(char *);
int readFile(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ writeFile(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *readFilePtr, *resultFilePtr;
  char *buff = malloc(100 * sizeof(char));
  openFile(&readFilePtr, &resultFilePtr);
  while (readFile(readFilePtr, buff) == !(0))
    processCommands(buff);
  writeFile(resultFilePtr);
}


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)
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <openFile@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <readFile@plt>
cmp    $0x1,%eax
jne    11a5 <main+0x55>
mov    -0x28(%rbp),%rdi
call   1040 <processCommands@plt>
jmp    1181 <main+0x31>
mov    -0x20(%rbp),%rdi
call   1050 <writeFile@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1030 <openFile@plt>
nop
mov    (%rsp),%rdi
mov    %rbx,%rsi
call   1070 <readFile@plt>
cmp    $0x1,%eax
jne    118b <main+0x3b>
mov    %rbx,%rdi
call   1040 <processCommands@plt>
jmp    1170 <main+0x20>
mov    0x8(%rsp),%rdi
call   1050 <writeFile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i8* @malloc(i32 100)
store i8* %9, i8** %8
%10 = call i32 @openFile(i32** %6, i32** %7)
br label %11
11: ; preds = %16, %2
%12 = load i32*, i32** %6
%13 = load i8*, i8** %8
%14 = call i32 @readFile(i32* %12, i8* %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %8
%18 = call i32 @processCommands(i8* %17)
br label %11
19: ; preds = %11
%20 = load i32*, i32** %7
%21 = call i32 @writeFile(i32* %20)
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = bitcast i32** %3 to i8*
%6 = bitcast i32** %4 to i8*
%7 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%8 = call i32 @openFile(i32** %3, i32** %4)
%9 = load i32*, i32** %3
%10 = call i32 @readFile(i32* %9, i8* %7)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %2, %12
%13 = call i32 @processCommands(i8* %7)
%14 = load i32*, i32** %3
%15 = call i32 @readFile(i32* %14, i8* %7)
%16 = icmp eq i32 %15, 1
br i1 %16, label %12, label %17
17: ; preds = %12, %2
%18 = load i32*, i32** %4
%19 = call i32 @writeFile(i32* %18)
ret i32 0
}