#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*/ editorOpen(char *);
int /*<<< orphan*/ editorProcessKeypress();
int /*<<< orphan*/ editorRefreshScreen();
int /*<<< orphan*/ editorSetStatusMessage(char *);
int /*<<< orphan*/ enableRawMode();
int /*<<< orphan*/ initEditor();
int main(int argc, char *argv[]) {
  enableRawMode();
  initEditor();
  if (argc >= 2) {
    editorOpen(argv[1]);
  }
  editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
  while (1) {
    editorRefreshScreen();
    editorProcessKeypress();
  }
  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)
mov    $0x0,%al
call   1030 <enableRawMode@plt>
mov    $0x0,%al
call   1080 <initEditor@plt>
cmpl   $0x2,-0x8(%rbp)
jl     119b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <editorOpen@plt>
lea    0xe5e(%rip),%rdi
call   1070 <editorSetStatusMessage@plt>
mov    $0x0,%al
call   1050 <editorRefreshScreen@plt>
mov    $0x0,%al
call   1060 <editorProcessKeypress@plt>
jmp    11a7 <main+0x47>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <enableRawMode@plt>
xor    %eax,%eax
call   1080 <initEditor@plt>
cmp    $0x2,%ebp
jl     1184 <main+0x24>
mov    0x8(%rbx),%rdi
call   1040 <editorOpen@plt>
lea    0xe75(%rip),%rdi
call   1070 <editorSetStatusMessage@plt>
xor    %eax,%eax
call   1050 <editorRefreshScreen@plt>
xor    %eax,%eax
call   1060 <editorProcessKeypress@plt>
jmp    1190 <main+0x30>

LLVM IR (-O0):
@.str = [52 x i8] c"HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find\00"
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 = call i32 (...) @enableRawMode()
%7 = call i32 (...) @initEditor()
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @editorOpen(i8* %13)
br label %15
15: ; preds = %10, %2
%16 = call i32 @editorSetStatusMessage(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %17
%18 = call i32 (...) @editorRefreshScreen()
%19 = call i32 (...) @editorProcessKeypress()
br label %17
}

LLVM IR (-O2):
@.str = [52 x i8] c"HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @enableRawMode()
%4 = tail call i32 (...) @initEditor()
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @editorOpen(i8* %8)
br label %10
10: ; preds = %6, %2
%11 = tail call i32 @editorSetStatusMessage(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %12
%13 = tail call i32 (...) @editorRefreshScreen()
%14 = tail call i32 (...) @editorProcessKeypress()
br label %12
}