#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*/ CopyFile(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ Usage(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strrchr(char *, char);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  int i;
  FILE *in, *out;
  char buffer[1024], *pt;
  if (argc == 1)
    Usage(argv[0]);
  for (i = 1; i < argc; ++i) {
    if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "-h") == 0)
      Usage(argv[0]);
    strcpy(buffer, argv[i]);
    pt = strstr(buffer, ".dfont");
    if (pt == NULL)
      pt = strrchr(buffer, '.');
    if (pt != NULL)
      strcpy(pt, ".bin");
    else
      strcat(buffer, ".bin");
    in = fopen(argv[i], "r");
    out = fopen(buffer, "w");
    if (in == NULL || out == NULL) {
      fprintf(stderr, "Can't open input or output file for %s, %s\n", argv[i],
              buffer);
      exit(1);
    }
    CopyFile(out, in, argv[i]);
    fclose(out);
    fclose(in);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11df <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <Usage@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1387 <main+0x1d7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdfb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1236 <main+0x86>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xddf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1242 <main+0x92>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <Usage@plt>
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
lea    -0x430(%rbp),%rdi
lea    0xda1(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x438(%rbp)
cmpq   $0x0,-0x438(%rbp)
jne    129a <main+0xea>
lea    -0x430(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x438(%rbp)
cmpq   $0x0,-0x438(%rbp)
je     12c0 <main+0x110>
mov    -0x438(%rbp),%rdi
lea    0xd5a(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12d3 <main+0x123>
lea    -0x430(%rbp),%rdi
lea    0xd42(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd2f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    -0x430(%rbp),%rdi
lea    0xd1a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     131c <main+0x16c>
cmpq   $0x0,-0x28(%rbp)
jne    134e <main+0x19e>
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    -0x430(%rbp),%rcx
lea    0xcda(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   10b0 <CopyFile@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e6 <main+0x36>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jne    11d6 <main+0x26>
mov    (%rbx),%rdi
call   1060 <Usage@plt>
jmp    12d1 <main+0x121>
jle    12d1 <main+0x121>
mov    %edi,%r14d
mov    $0x1,%ebp
mov    %rsp,%r15
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
lea    0xe05(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     121a <main+0x6a>
mov    (%rbx,%rbp,8),%rdi
lea    0xdf6(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1222 <main+0x72>
mov    (%rbx),%rdi
call   1060 <Usage@plt>
mov    (%rbx,%rbp,8),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
lea    0xdd1(%rip),%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
jne    1254 <main+0xa4>
mov    %r15,%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     12c0 <main+0x110>
mov    %rax,%rdi
lea    0xdb2(%rip),%rsi
call   1030 <strcpy@plt>
mov    (%rbx,%rbp,8),%rdi
lea    0xda7(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
mov    %r15,%rdi
lea    0xd97(%rip),%rsi
call   1090 <fopen@plt>
test   %r12,%r12
je     12e5 <main+0x135>
mov    %rax,%r13
test   %rax,%rax
je     12e5 <main+0x135>
mov    (%rbx,%rbp,8),%rdx
mov    %r13,%rdi
mov    %r12,%rsi
call   10b0 <CopyFile@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11f0 <main+0x40>
jmp    12d1 <main+0x121>
mov    %r15,%rdi
lea    0xd46(%rip),%rsi
call   10a0 <strcat@plt>
jmp    1263 <main+0xb3>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    (%rbx,%rbp,8),%rdx
lea    0xd20(%rip),%rsi
mov    %rsp,%rcx
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"-help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c".dfont\00"
@.str.3 = [5 x i8] c".bin\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.6 = [44 x i8] c"Can't open input or output file for %s, %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [1024 x i8]
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @Usage(i8* %16)
br label %18
18: ; preds = %13, %2
store i32 1, i32* %6
br label %19
19: ; preds = %105, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %108
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %23
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %31, %23
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 0
%42 = load i8*, i8** %41
%43 = call i32 @Usage(i8* %42)
br label %44
44: ; preds = %39, %31
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%46 = load i8**, i8*** %5
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = call i32 @strcpy(i8* %45, i8* %50)
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%53 = call i8* @strstr(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i8* %53, i8** %10
%54 = load i8*, i8** %10
%55 = icmp eq i8* %54, null
br i1 %55, label %56, label %59
56: ; preds = %44
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%58 = call i8* @strrchr(i8* %57, i8 signext 46)
store i8* %58, i8** %10
br label %59
59: ; preds = %56, %44
%60 = load i8*, i8** %10
%61 = icmp ne i8* %60, null
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load i8*, i8** %10
%64 = call i32 @strcpy(i8* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %68
65: ; preds = %59
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %65, %62
%69 = load i8**, i8*** %5
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i32* @fopen(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %74, i32** %7
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%76 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %76, i32** %8
%77 = load i32*, i32** %7
%78 = icmp eq i32* %77, null
br i1 %78, label %82, label %79
79: ; preds = %68
%80 = load i32*, i32** %8
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %92
82: ; preds = %79, %68
%83 = load i32, i32* @stderr
%84 = load i8**, i8*** %5
%85 = load i32, i32* %6
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %84, i64 %86
%88 = load i8*, i8** %87
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%90 = call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* %88, i8* %89)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %79
%93 = load i32*, i32** %8
%94 = load i32*, i32** %7
%95 = load i8**, i8*** %5
%96 = load i32, i32* %6
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
%99 = load i8*, i8** %98
%100 = call i32 @CopyFile(i32* %93, i32* %94, i8* %99)
%101 = load i32*, i32** %8
%102 = call i32 @fclose(i32* %101)
%103 = load i32*, i32** %7
%104 = call i32 @fclose(i32* %103)
br label %105
105: ; preds = %92
%106 = load i32, i32* %6
%107 = add nsw i32 %106, 1
store i32 %107, i32* %6
br label %19
108: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"-help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c".dfont\00"
@.str.3 = [5 x i8] c".bin\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.6 = [44 x i8] c"Can't open input or output file for %s, %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @Usage(i8* %7)
br label %58
9: ; preds = %2
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %58
11: ; preds = %9
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %11, %51
%14 = phi i64 [ 1, %11 ], [ %56, %51 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %13
%20 = load i8*, i8** %15
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19, %13
%24 = load i8*, i8** %1
%25 = call i32 @Usage(i8* %24)
br label %26
26: ; preds = %23, %19
%27 = load i8*, i8** %15
%28 = call i32 @strcpy(i8* %4, i8* %27)
%29 = call i8* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = call i8* @strrchr(i8* %4, i8 signext 46)
%33 = icmp eq i8* %32, null
br i1 %33, label %37, label %34
34: ; preds = %26, %31
%35 = phi i8* [ %32, %31 ], [ %29, %26 ]
%36 = call i32 @strcpy(i8* %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %39
37: ; preds = %31
%38 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = load i8*, i8** %15
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%43 = icmp eq i32* %41, null
%44 = icmp eq i32* %42, null
%45 = or i1 %43, %44
br i1 %45, label %46, label %51
46: ; preds = %39
%47 = load i32, i32* @stderr
%48 = load i8*, i8** %15
%49 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* %48, i8* %4)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %39
%52 = load i8*, i8** %15
%53 = call i32 @CopyFile(i32* %42, i32* %41, i8* %52)
%54 = call i32 @fclose(i32* %42)
%55 = call i32 @fclose(i32* %41)
%56 = add nuw nsw i64 %14, 1
%57 = icmp eq i64 %56, %12
br i1 %57, label %58, label %13
58: ; preds = %51, %6, %9
ret i32 0
}