#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*/ checkcond();
int /*<<< orphan*/ diff();
int /*<<< orphan*/ loadrules(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ updatelist();
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("Error: You must provide a rules script.\n");
    printf("Example: procmon ./gamewatch.prm\n");
    return 127;
  }
  loadrules(argv[1]);
  updatelist();
reupdate:
  diff();
  checkcond();
  sleep(1);
  goto reupdate;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    11a3 <main+0x43>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    $0x7f,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <loadrules@plt>
mov    $0x0,%al
call   1080 <updatelist@plt>
mov    $0x0,%al
call   1070 <diff@plt>
mov    $0x0,%al
call   1030 <checkcond@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    11b7 <main+0x57>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     1185 <main+0x25>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x7f,%eax
pop    %rcx
ret
mov    0x8(%rsi),%rdi
call   1050 <loadrules@plt>
xor    %eax,%eax
call   1080 <updatelist@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1070 <diff@plt>
xor    %eax,%eax
call   1040 <checkcond@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    11a0 <main+0x40>

LLVM IR (-O0):
@.str = [41 x i8] c"Error: You must provide a rules script.\0A\00"
@.str.1 = [34 x i8] c"Example: procmon ./gamewatch.prm\0A\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 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
ret i32 127
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @loadrules(i8* %14)
%16 = call i32 (...) @updatelist()
br label %17
17: ; preds = %17, %11
%18 = call i32 (...) @diff()
%19 = call i32 (...) @checkcond()
%20 = call i32 @sleep(i32 1)
br label %17
}

LLVM IR (-O2):
@str = [40 x i8] c"Error: You must provide a rules script.\00"
@str.2 = [33 x i8] c"Example: procmon ./gamewatch.prm\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.2, i64 0, i64 0))
ret i32 127
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @loadrules(i8* %9)
%11 = tail call i32 (...) @updatelist()
br label %12
12: ; preds = %12, %7
%13 = tail call i32 (...) @diff()
%14 = tail call i32 (...) @checkcond()
%15 = tail call i32 @sleep(i32 1)
br label %12
}