#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*/ convert(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  char *prefix;
  argc--;
  if (argc != 2 && argc != 3) {
    printf("usage: bin2c <input> <output> [prefix]\n");
    return 0;
  }
  prefix = (argc == 3) ? argv[3] : "file";
  convert(argv[1], argv[2], prefix);
  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)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116b <main+0x4b>
cmpl   $0x3,-0x8(%rbp)
je     116b <main+0x4b>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11be <main+0x9e>
cmpl   $0x3,-0x8(%rbp)
jne    1186 <main+0x66>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1196 <main+0x76>
lea    0xe9b(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1196 <main+0x76>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <convert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
add    $0xffffffff,%edi
mov    %edi,%eax
and    $0xfffffffe,%eax
cmp    $0x2,%eax
jne    1139 <main+0x19>
cmp    $0x3,%edi
jne    1147 <main+0x27>
mov    0x18(%rsi),%rdx
jmp    114e <main+0x2e>
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
jmp    115b <main+0x3b>
lea    0xeb2(%rip),%rdx
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <convert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"usage: bin2c <input> <output> [prefix]\0A\00"
@.str.1 = [5 x i8] c"file\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %34
16: ; preds = %11, %2
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
br label %24
23: ; preds = %16
br label %24
24: ; preds = %23, %19
%25 = phi i8* [ %22, %19 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %23 ]
store i8* %25, i8** %6
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = load i8*, i8** %6
%33 = call i32 @convert(i8* %28, i8* %31, i8* %32)
store i32 0, i32* %3
br label %34
34: ; preds = %24, %14
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"file\00"
@str = [39 x i8] c"usage: bin2c <input> <output> [prefix]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = and i32 %3, -2
%5 = icmp eq i32 %4, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %20
8: ; preds = %2
%9 = icmp eq i32 %3, 3
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
br label %13
13: ; preds = %8, %10
%14 = phi i8* [ %12, %10 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %8 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @convert(i8* %16, i8* %18, i8* %14)
br label %20
20: ; preds = %13, %6
ret i32 0
}