#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[]) {
  initEditor();
  editorRefreshScreen();
  enableRawMode();
  if (argc >= 2) {
    editorOpen(argv[1]);
  }
  editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit");
  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   1080 <initEditor@plt>
mov    $0x0,%al
call   1050 <editorRefreshScreen@plt>
mov    $0x0,%al
call   1030 <enableRawMode@plt>
cmpl   $0x2,-0x8(%rbp)
jl     11a2 <main+0x42>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <editorOpen@plt>
lea    0xe57(%rip),%rdi
call   1070 <editorSetStatusMessage@plt>
mov    $0x0,%al
call   1050 <editorRefreshScreen@plt>
mov    $0x0,%al
call   1060 <editorProcessKeypress@plt>
jmp    11ae <main+0x4e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <initEditor@plt>
xor    %eax,%eax
call   1050 <editorRefreshScreen@plt>
xor    %eax,%eax
call   1030 <enableRawMode@plt>
cmp    $0x2,%ebp
jl     118b <main+0x2b>
mov    0x8(%rbx),%rdi
call   1040 <editorOpen@plt>
lea    0xe6e(%rip),%rdi
call   1070 <editorSetStatusMessage@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <editorRefreshScreen@plt>
xor    %eax,%eax
call   1060 <editorProcessKeypress@plt>
jmp    11a0 <main+0x40>

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

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