#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*/ DumpResourceMaps(char *);
int /*<<< orphan*/ LoadResourceMap(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i;
  if (argc < 3) {
    fprintf(stderr,
            "Usage: %s base.dfont additional.dfont ...\n\t merges any "
            "additional resource files into base.\n",
            argv[0]);
    exit(1);
  }
  for (i = 1; i < argc; ++i)
    if (!LoadResourceMap(argv[i])) {
      fprintf(stderr, "Can't find an appropriate resource fork in %s\n",
              argv[i]);
      exit(1);
    }
  DumpResourceMaps(argv[1]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1186 <main+0x46>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f1 <main+0xb1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <LoadResourceMap@plt>
cmp    $0x0,%eax
jne    11de <main+0x9e>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe8e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11e3 <main+0xa3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <DumpResourceMaps@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x3,%edi
jl     11aa <main+0x6a>
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <LoadResourceMap@plt>
test   %eax,%eax
je     1187 <main+0x47>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <main+0x20>
mov    0x8(%r14),%rdi
call   1050 <DumpResourceMaps@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%rbx,8),%rdx
lea    0xec2(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe43(%rip),%rsi
jmp    119b <main+0x5b>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [93 x i8] c"Usage: %s base.dfont additional.dfont ...\0A\09 merges any additional resource files into base.\0A\00"
@.str.1 = [47 x i8] c"Can't find an appropriate resource fork in %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
store i32 1, i32* %6
br label %17
17: ; preds = %39, %16
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %42
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @LoadResourceMap(i8* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %38, label %29
29: ; preds = %21
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %21
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %17
42: ; preds = %17
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @DumpResourceMaps(i8* %45)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [93 x i8] c"Usage: %s base.dfont additional.dfont ...\0A\09 merges any additional resource files into base.\0A\00"
@.str.1 = [47 x i8] c"Can't find an appropriate resource fork in %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4, %24
%12 = phi i64 [ 1, %4 ], [ %25, %24 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @LoadResourceMap(i8* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %11
%18 = and i64 %12, 4294967295
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %19
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %11
%25 = add nuw nsw i64 %12, 1
%26 = icmp eq i64 %25, %5
br i1 %26, label %27, label %11
27: ; preds = %24
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = tail call i32 @DumpResourceMaps(i8* %29)
ret i32 0
}