#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 */
int /*<<< orphan*/ convert(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int main(int argc, char *argv[]) {
  FILE *f1, *f2;
  if (argc != 3) {
    error("usage: makeclassdef mnemfile classfile");
  }
  if ((f1 = fopen(argv[1], "r")) == NULL) {
    error("cannot open mnemonic file");
  }
  if ((f2 = fopen(argv[2], "r")) == NULL) {
    error("cannot open class file");
  }
  convert(f1, f2);
  exit(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)
je     116c <main+0x2c>
lea    0xe99(%rip),%rdi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeac(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    119a <main+0x5a>
lea    0xe94(%rip),%rdi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11c8 <main+0x88>
lea    0xe80(%rip),%rdi
call   1040 <error@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <convert@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1158 <main+0x18>
lea    0xead(%rip),%rdi
call   1040 <error@plt>
mov    0x8(%rbx),%rdi
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    117c <main+0x3c>
lea    0xeb2(%rip),%rdi
call   1040 <error@plt>
mov    0x10(%rbx),%rdi
lea    0xea0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11a0 <main+0x60>
lea    0xea8(%rip),%rdi
call   1040 <error@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <convert@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"usage: makeclassdef mnemfile classfile\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"cannot open mnemonic file\00"
@.str.3 = [23 x i8] c"cannot open class file\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %7
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %20
%29 = load i32*, i32** %6
%30 = load i32*, i32** %7
%31 = call i32 @convert(i32* %29, i32* %30)
%32 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [39 x i8] c"usage: makeclassdef mnemfile classfile\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"cannot open mnemonic file\00"
@.str.3 = [23 x i8] c"cannot open class file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = tail call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %13
%21 = tail call i32 @convert(i32* %9, i32* %16)
%22 = tail call i32 @exit(i32 0)
unreachable
}