#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*/ Iso2Raw_convert(char *, char *, char *);
int /*<<< orphan*/ Iso2Raw_init();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  puts("mkpsxiso (C Edition) v0.1b - Converts a standard ISO image to "
       ".bin/.cue (PSX)");
  puts("This software is based on Bruno Freitas' mkpsxiso in Java - "
       "bootsector@ig.com.br");
  puts("That version is in turn based on Conyers' mkpsxiso - "
       "http://www.conyers.demon.co.uk");
  puts("Author: Giuseppe Gatta (aka nextvolume) - 01/07/2009 - "
       "tails92@gmail.com\n");
  if (argc != 4) {
    printf("Usage: mkpsxiso <iso file> <bin file> <PSX license file>\n");
    return 1;
  }
  Iso2Raw_init();
  if (!Iso2Raw_convert(argv[1], argv[2], argv[3])) {
    puts("ISO file conversion failed.");
    return 1;
  }
  puts("ISO file conversion terminated successfully!!");
  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)
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf72(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x4,-0x8(%rbp)
je     11a8 <main+0x68>
lea    0xfa6(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1200 <main+0xc0>
mov    $0x0,%al
call   1050 <Iso2Raw_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1060 <Iso2Raw_convert@plt>
cmp    $0x0,%eax
jne    11ed <main+0xad>
lea    0xf9b(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1200 <main+0xc0>
lea    0xf9f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xf90(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x4,%ebp
jne    1199 <main+0x69>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <Iso2Raw_init@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    0x18(%rbx),%rdx
call   1050 <Iso2Raw_convert@plt>
test   %eax,%eax
je     11a2 <main+0x72>
lea    0xfc7(%rip),%rdi
call   1030 <puts@plt>
jmp    11b3 <main+0x83>
lea    0xfe7(%rip),%rdi
jmp    11a9 <main+0x79>
lea    0xf94(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [78 x i8] c"mkpsxiso (C Edition) v0.1b - Converts a standard ISO image to .bin/.cue (PSX)\00"
@.str.1 = [81 x i8] c"This software is based on Bruno Freitas' mkpsxiso in Java - bootsector@ig.com.br\00"
@.str.2 = [84 x i8] c"That version is in turn based on Conyers' mkpsxiso - http://www.conyers.demon.co.uk\00"
@.str.3 = [74 x i8] c"Author: Giuseppe Gatta (aka nextvolume) - 01/07/2009 - tails92@gmail.com\0A\00"
@.str.4 = [58 x i8] c"Usage: mkpsxiso <iso file> <bin file> <PSX license file>\0A\00"
@.str.5 = [28 x i8] c"ISO file conversion failed.\00"
@.str.6 = [46 x i8] c"ISO file conversion terminated successfully!!\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 @puts(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0))
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %31
14: ; preds = %2
%15 = call i32 (...) @Iso2Raw_init()
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = call i32 @Iso2Raw_convert(i8* %18, i8* %21, i8* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %14
%28 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %31
29: ; preds = %14
%30 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %31
31: ; preds = %29, %27, %12
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [78 x i8] c"mkpsxiso (C Edition) v0.1b - Converts a standard ISO image to .bin/.cue (PSX)\00"
@.str.1 = [81 x i8] c"This software is based on Bruno Freitas' mkpsxiso in Java - bootsector@ig.com.br\00"
@.str.2 = [84 x i8] c"That version is in turn based on Conyers' mkpsxiso - http://www.conyers.demon.co.uk\00"
@.str.3 = [74 x i8] c"Author: Giuseppe Gatta (aka nextvolume) - 01/07/2009 - tails92@gmail.com\0A\00"
@.str.5 = [28 x i8] c"ISO file conversion failed.\00"
@.str.6 = [46 x i8] c"ISO file conversion terminated successfully!!\00"
@str = [57 x i8] c"Usage: mkpsxiso <iso file> <bin file> <PSX license file>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp eq i32 %0, 4
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
br label %24
10: ; preds = %2
%11 = tail call i32 (...) @Iso2Raw_init()
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @Iso2Raw_convert(i8* %13, i8* %15, i8* %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %10
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %24
22: ; preds = %10
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %24
24: ; preds = %22, %20, %8
%25 = phi i32 [ 1, %8 ], [ 0, %22 ], [ 1, %20 ]
ret i32 %25
}