#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*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int bin2c(char *in_path, char *out_path, int length, char *var_name) {
  int ret = 0;
  unsigned char buffer[1024];
  FILE *fin = NULL;
  FILE *fout = NULL;
  int program_code_on = 0;
  int start = 1;
  int read_byte = 0;
  int image_buffer_size = 0;
  fin = fopen(in_path, "rb");
  if (fin == NULL) {
    ret = -1;
    goto err1;
  }
  fout = fopen(out_path, "wb");
  if (fout == NULL) {
    ret = -2;
    goto err2;
  }
  fseek(fin, 0, SEEK_END);
  image_buffer_size = ftell(fin);
  fseek(fin, 0, SEEK_SET);
  while (read_byte = fread(buffer, 1, 1024, fin)) {
    if (start) {
      time_t rawtime;
      struct tm *timeinfo;
      time(&rawtime);
      timeinfo = localtime(&rawtime);
      fprintf(fout, "/*********************************************************"
                    "***********************\n");
      fprintf(fout, "\tAutomatic Generation By bin2c.\n");
      fprintf(fout,
              "\tCopyright "
              "Ringsd"
              ". %04d.\n\n",
              timeinfo->tm_year + 1900);
      fprintf(fout, "\tAll Rights Reserved.\n\n");
      fprintf(fout, "\tFile: %s\n\n", out_path);
      fprintf(fout, "\tDescription:\n\n");
      fprintf(fout, "\tTIME LIST:\n");
      fprintf(fout,
              "\tCREATE By "
              "Ringsd"
              "   %04d/%02d/%02d %02d:%02d:%02d\n\n",
              timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday,
              timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
      fprintf(fout, "**********************************************************"
                    "**********************/\n\n");
      fprintf(fout, "static int %s_size = %d;\n", var_name, image_buffer_size);
      fprintf(fout, "static unsigned char %s[] = {\n", var_name);
      start = 0;
    }
    if (read_byte) {
      int i = 0;
      for (i = 0; i < read_byte; i++) {
        fprintf(fout, "0x%02x, ", buffer[i]);
        if (((i + 1) % length) == 0) {
          fprintf(fout, "\n");
        }
      }
    }
  }
  fprintf(fout, "\n");
  fprintf(fout, "};\n");
  fprintf(fout, "\n");
  fprintf(fout, "\n");
  fprintf(fout, "/*************************************************************"
                "*******************\n");
  fprintf(fout, "    END OF FILE\n");
  fprintf(fout, "**************************************************************"
                "******************/\n");
  fclose(fout);
err2:
  fclose(fin);
err1:
  return ret;
}


x86 assembly (clang, -O0):
<bin2c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x438(%rbp)
movq   $0x0,-0x440(%rbp)
movl   $0x0,-0x444(%rbp)
movl   $0x1,-0x448(%rbp)
movl   $0x0,-0x44c(%rbp)
movl   $0x0,-0x450(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x438(%rbp)
cmpq   $0x0,-0x438(%rbp)
jne    1210 <bin2c+0x90>
movl   $0xffffffff,-0x24(%rbp)
jmp    158a <bin2c+0x40a>
mov    -0x10(%rbp),%rdi
lea    0xde8(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x440(%rbp)
cmpq   $0x0,-0x440(%rbp)
jne    1241 <bin2c+0xc1>
movl   $0xfffffffe,-0x24(%rbp)
jmp    157e <bin2c+0x3fe>
mov    -0x438(%rbp),%rdi
mov    0x2d99(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x438(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x450(%rbp)
mov    -0x438(%rbp),%rdi
mov    0x2d60(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
lea    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
mov    %eax,-0x44c(%rbp)
cmp    $0x0,%eax
je     14df <bin2c+0x35f>
cmpl   $0x0,-0x448(%rbp)
je     143a <bin2c+0x2ba>
lea    -0x454(%rbp),%rdi
call   1080 <time@plt>
lea    -0x454(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x460(%rbp)
mov    -0x440(%rbp),%rdi
lea    0xd1f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xd5d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x460(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
lea    0xd5a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xd60(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd5f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xd56(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xd51(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x460(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x460(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x460(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x460(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x460(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x460(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xd02(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xd19(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x450(%rbp),%ecx
lea    0xd4e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd4f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x448(%rbp)
cmpl   $0x0,-0x44c(%rbp)
je     14da <bin2c+0x35a>
movl   $0x0,-0x464(%rbp)
movl   $0x0,-0x464(%rbp)
mov    -0x464(%rbp),%eax
cmp    -0x44c(%rbp),%eax
jge    14d5 <bin2c+0x355>
mov    -0x440(%rbp),%rdi
movslq -0x464(%rbp),%rax
movzbl -0x430(%rbp,%rax,1),%edx
ff
lea    0xd0d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x464(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    14bc <bin2c+0x33c>
mov    -0x440(%rbp),%rdi
lea    0xbde(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    14c1 <bin2c+0x341>
mov    -0x464(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x464(%rbp)
jmp    145b <bin2c+0x2db>
jmp    14da <bin2c+0x35a>
jmp    1281 <bin2c+0x101>
mov    -0x440(%rbp),%rdi
lea    0xba6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xb7c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xb67(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xac5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xc4e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x440(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x438(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x24(%rbp),%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin2c>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rcx,0x20(%rsp)
mov    %edx,%r12d
mov    %rsi,%rbx
lea    0xe3d(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14bf <bin2c+0x31f>
mov    %rax,%r15
lea    0xe28(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14c6 <bin2c+0x326>
mov    %rax,%r13
mov    %rbx,0x18(%rsp)
mov    0x2ded(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r15,%rdi
call   1080 <ftell@plt>
mov    %eax,0xc(%rsp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
test   %eax,%eax
je     1428 <bin2c+0x288>
mov    %eax,%ebx
lea    0xf49(%rip),%r14
xor    %eax,%eax
mov    %r15,0x10(%rsp)
jmp    1283 <bin2c+0xe3>
nopw   0x0(%rax,%rax,1)
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
mov    %eax,%ebx
mov    $0x1,%al
test   %ebx,%ebx
je     1428 <bin2c+0x288>
test   $0x1,%al
jne    13d4 <bin2c+0x234>
lea    0x2c(%rsp),%rbp
mov    %rbp,%rdi
call   1090 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
mov    %rax,%r15
mov    $0x52,%esi
mov    $0x1,%edx
lea    0xd52(%rip),%rdi
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    $0x20,%esi
mov    $0x1,%edx
lea    0xd8c(%rip),%rdi
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    (%r15),%edx
mov    $0x76c,%ebp
add    %ebp,%edx
mov    %r13,%rdi
lea    0xd91(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x17,%esi
mov    $0x1,%edx
lea    0xd94(%rip),%rdi
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    %r13,%rdi
lea    0xd9a(%rip),%rsi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xf,%esi
mov    $0x1,%edx
lea    0xd89(%rip),%rdi
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    $0xc,%esi
mov    $0x1,%edx
lea    0xd80(%rip),%rdi
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    (%r15),%edx
add    %ebp,%edx
mov    0x4(%r15),%ecx
mov    0x8(%r15),%r8d
add    $0x1,%ecx
mov    0xc(%r15),%r9d
mov    0x10(%r15),%r10d
mov    0x14(%r15),%ebp
mov    0x10(%rsp),%r15
mov    %r13,%rdi
lea    0xd5a(%rip),%rsi
xor    %eax,%eax
push   %rbp
push   %r10
call   1070 <fprintf@plt>
add    $0x10,%rsp
mov    $0x53,%esi
mov    $0x1,%edx
lea    0xd6f(%rip),%rdi
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    %r13,%rdi
lea    0xdb1(%rip),%rsi
mov    0x20(%rsp),%rbp
mov    %rbp,%rdx
mov    0xc(%rsp),%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
lea    0xdae(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %ebx,%ebx
jle    1260 <bin2c+0xc0>
mov    %ebx,%ebp
xor    %ebx,%ebx
jmp    13f9 <bin2c+0x259>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %rbx,%rbp
je     1260 <bin2c+0xc0>
movzbl 0x30(%rsp,%rbx,1),%edx
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%rbx
mov    %ebx,%eax
cltd
idiv   %r12d
test   %edx,%edx
jne    13f0 <bin2c+0x250>
mov    $0xa,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
jmp    13f0 <bin2c+0x250>
mov    $0xa,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
lea    0xd64(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
lea    0xb97(%rip),%rdi
mov    $0x52,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10c0 <fwrite@plt>
lea    0xd1c(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10c0 <fwrite@plt>
lea    0xd14(%rip),%rdi
mov    $0x52,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10c0 <fwrite@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
xor    %ebx,%ebx
jmp    14cb <bin2c+0x32b>
mov    $0xffffffff,%ebx
jmp    14d3 <bin2c+0x333>
mov    $0xfffffffe,%ebx
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %ebx,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [83 x i8] c"/********************************************************************************\0A\00"
@.str.3 = [33 x i8] c"\09Automatic Generation By bin2c.\0A\00"
@.str.4 = [27 x i8] c"\09Copyright Ringsd. %04d.\0A\0A\00"
@.str.5 = [24 x i8] c"\09All Rights Reserved.\0A\0A\00"
@.str.6 = [12 x i8] c"\09File: %s\0A\0A\00"
@.str.7 = [16 x i8] c"\09Description:\0A\0A\00"
@.str.8 = [13 x i8] c"\09TIME LIST:\0A\00"
@.str.9 = [52 x i8] c"\09CREATE By Ringsd %04d/%02d/%02d %02d:%02d:%02d\0A\0A\00"
@.str.10 = [84 x i8] c"********************************************************************************/\0A\0A\00"
@.str.11 = [26 x i8] c"static int %s_size = %d;\0A\00"
@.str.12 = [31 x i8] c"static unsigned char %s[] = {\0A\00"
@.str.13 = [9 x i8] c"0x%02x, \00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [4 x i8] c"};\0A\00"
@.str.16 = [17 x i8] c" END OF FILE\0A\00"
@.str.17 = [83 x i8] c"********************************************************************************/\0A\00"
define i32 @bin2c(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [1024 x i8]
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.tm*
%19 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i32 0, i32* %9
store i32* null, i32** %11
store i32* null, i32** %12
store i32 0, i32* %13
store i32 1, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%20 = load i8*, i8** %5
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %11
%22 = load i32*, i32** %11
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %4
store i32 -1, i32* %9
br label %151
25: ; preds = %4
%26 = load i8*, i8** %6
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %12
%28 = load i32*, i32** %12
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 -2, i32* %9
br label %148
31: ; preds = %25
%32 = load i32*, i32** %11
%33 = load i32, i32* @SEEK_END
%34 = call i32 @fseek(i32* %32, i32 0, i32 %33)
%35 = load i32*, i32** %11
%36 = call i32 @ftell(i32* %35)
store i32 %36, i32* %16
%37 = load i32*, i32** %11
%38 = load i32, i32* @SEEK_SET
%39 = call i32 @fseek(i32* %37, i32 0, i32 %38)
br label %40
40: ; preds = %130, %31
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%42 = load i32*, i32** %11
%43 = call i32 @fread(i8* %41, i32 1, i32 1024, i32* %42)
store i32 %43, i32* %15
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %131
45: ; preds = %40
%46 = load i32, i32* %14
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %101
48: ; preds = %45
%49 = call i32 @time(i32* %17)
%50 = call %struct.tm* @localtime(i32* %17)
store %struct.tm* %50, %struct.tm** %18
%51 = load i32*, i32** %12
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32*, i32** %12
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%55 = load i32*, i32** %12
%56 = load %struct.tm*, %struct.tm** %18
%57 = getelementptr inbounds %struct.tm, %struct.tm* %56, i32 0, i32 0
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 1900
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %59)
%61 = load i32*, i32** %12
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%63 = load i32*, i32** %12
%64 = load i8*, i8** %6
%65 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %64)
%66 = load i32*, i32** %12
%67 = call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%68 = load i32*, i32** %12
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%70 = load i32*, i32** %12
%71 = load %struct.tm*, %struct.tm** %18
%72 = getelementptr inbounds %struct.tm, %struct.tm* %71, i32 0, i32 0
%73 = load i32, i32* %72
%74 = add nsw i32 %73, 1900
%75 = load %struct.tm*, %struct.tm** %18
%76 = getelementptr inbounds %struct.tm, %struct.tm* %75, i32 0, i32 1
%77 = load i32, i32* %76
%78 = add nsw i32 %77, 1
%79 = load %struct.tm*, %struct.tm** %18
%80 = getelementptr inbounds %struct.tm, %struct.tm* %79, i32 0, i32 2
%81 = load i32, i32* %80
%82 = load %struct.tm*, %struct.tm** %18
%83 = getelementptr inbounds %struct.tm, %struct.tm* %82, i32 0, i32 3
%84 = load i32, i32* %83
%85 = load %struct.tm*, %struct.tm** %18
%86 = getelementptr inbounds %struct.tm, %struct.tm* %85, i32 0, i32 4
%87 = load i32, i32* %86
%88 = load %struct.tm*, %struct.tm** %18
%89 = getelementptr inbounds %struct.tm, %struct.tm* %88, i32 0, i32 5
%90 = load i32, i32* %89
%91 = call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i32 %74, i32 %78, i32 %81, i32 %84, i32 %87, i32 %90)
%92 = load i32*, i32** %12
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.10, i64 0, i64 0))
%94 = load i32*, i32** %12
%95 = load i8*, i8** %8
%96 = load i32, i32* %16
%97 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i8* %95, i32 %96)
%98 = load i32*, i32** %12
%99 = load i8*, i8** %8
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %99)
store i32 0, i32* %14
br label %101
101: ; preds = %48, %45
%102 = load i32, i32* %15
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %130
104: ; preds = %101
store i32 0, i32* %19
store i32 0, i32* %19
br label %105
105: ; preds = %126, %104
%106 = load i32, i32* %19
%107 = load i32, i32* %15
%108 = icmp slt i32 %106, %107
br i1 %108, label %109, label %129
109: ; preds = %105
%110 = load i32*, i32** %12
%111 = load i32, i32* %19
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %112
%114 = load i8, i8* %113
%115 = zext i8 %114 to i32
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %19
%118 = add nsw i32 %117, 1
%119 = load i32, i32* %7
%120 = srem i32 %118, %119
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %125
122: ; preds = %109
%123 = load i32*, i32** %12
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
br label %125
125: ; preds = %122, %109
br label %126
126: ; preds = %125
%127 = load i32, i32* %19
%128 = add nsw i32 %127, 1
store i32 %128, i32* %19
br label %105
129: ; preds = %105
br label %130
130: ; preds = %129, %101
br label %40
131: ; preds = %40
%132 = load i32*, i32** %12
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %132, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%134 = load i32*, i32** %12
%135 = call i32 (i32*, i8*, ...) @fprintf(i32* %134, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%136 = load i32*, i32** %12
%137 = call i32 (i32*, i8*, ...) @fprintf(i32* %136, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%138 = load i32*, i32** %12
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%140 = load i32*, i32** %12
%141 = call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
%142 = load i32*, i32** %12
%143 = call i32 (i32*, i8*, ...) @fprintf(i32* %142, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0))
%144 = load i32*, i32** %12
%145 = call i32 (i32*, i8*, ...) @fprintf(i32* %144, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.17, i64 0, i64 0))
%146 = load i32*, i32** %12
%147 = call i32 @fclose(i32* %146)
br label %148
148: ; preds = %131, %30
%149 = load i32*, i32** %11
%150 = call i32 @fclose(i32* %149)
br label %151
151: ; preds = %148, %24
%152 = load i32, i32* %9
ret i32 %152
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [83 x i8] c"/********************************************************************************\0A\00"
@.str.3 = [33 x i8] c"\09Automatic Generation By bin2c.\0A\00"
@.str.4 = [27 x i8] c"\09Copyright Ringsd. %04d.\0A\0A\00"
@.str.5 = [24 x i8] c"\09All Rights Reserved.\0A\0A\00"
@.str.6 = [12 x i8] c"\09File: %s\0A\0A\00"
@.str.7 = [16 x i8] c"\09Description:\0A\0A\00"
@.str.8 = [13 x i8] c"\09TIME LIST:\0A\00"
@.str.9 = [52 x i8] c"\09CREATE By Ringsd %04d/%02d/%02d %02d:%02d:%02d\0A\0A\00"
@.str.10 = [84 x i8] c"********************************************************************************/\0A\0A\00"
@.str.11 = [26 x i8] c"static int %s_size = %d;\0A\00"
@.str.12 = [31 x i8] c"static unsigned char %s[] = {\0A\00"
@.str.13 = [9 x i8] c"0x%02x, \00"
@.str.15 = [4 x i8] c"};\0A\00"
@.str.16 = [17 x i8] c" END OF FILE\0A\00"
@.str.17 = [83 x i8] c"********************************************************************************/\0A\00"
define i32 @bin2c(i8* nocapture %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %89, label %10
10: ; preds = %4
%11 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %86, label %13
13: ; preds = %10
%14 = load i32, i32* @SEEK_END
%15 = tail call i32 @fseek(i32* %8, i32 0, i32 %14)
%16 = tail call i32 @ftell(i32* %8)
%17 = load i32, i32* @SEEK_SET
%18 = tail call i32 @fseek(i32* %8, i32 0, i32 %17)
%19 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %8)
%20 = icmp eq i32 %19, 0
br i1 %20, label %77, label %21
21: ; preds = %13
%22 = bitcast i32* %6 to i8*
br label %26
23: ; preds = %75, %59
%24 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %8)
%25 = icmp eq i32 %24, 0
br i1 %25, label %77, label %26
26: ; preds = %21, %23
%27 = phi i32 [ %19, %21 ], [ %24, %23 ]
%28 = phi i1 [ false, %21 ], [ true, %23 ]
br i1 %28, label %59, label %29
29: ; preds = %26
%30 = call i32 @time(i32* %6)
%31 = call %struct.tm* @localtime(i32* %6)
%32 = call i64 @fwrite(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0), i64 82, i64 1, i32* %11)
%33 = call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i64 32, i64 1, i32* %11)
%34 = getelementptr inbounds %struct.tm, %struct.tm* %31, i64 0, i32 0
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1900
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i64 23, i64 1, i32* %11)
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%40 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 15, i64 1, i32* %11)
%41 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i64 12, i64 1, i32* %11)
%42 = load i32, i32* %34
%43 = add nsw i32 %42, 1900
%44 = getelementptr inbounds %struct.tm, %struct.tm* %31, i64 0, i32 1
%45 = load i32, i32* %44
%46 = add nsw i32 %45, 1
%47 = getelementptr inbounds %struct.tm, %struct.tm* %31, i64 0, i32 2
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.tm, %struct.tm* %31, i64 0, i32 3
%50 = load i32, i32* %49
%51 = getelementptr inbounds %struct.tm, %struct.tm* %31, i64 0, i32 4
%52 = load i32, i32* %51
%53 = getelementptr inbounds %struct.tm, %struct.tm* %31, i64 0, i32 5
%54 = load i32, i32* %53
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i32 %43, i32 %46, i32 %48, i32 %50, i32 %52, i32 %54)
%56 = call i64 @fwrite(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.10, i64 0, i64 0), i64 83, i64 1, i32* %11)
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i8* %3, i32 %16)
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i8* %3)
br label %59
59: ; preds = %26, %29
%60 = icmp sgt i32 %27, 0
br i1 %60, label %61, label %23
61: ; preds = %59
%62 = zext i32 %27 to i64
br label %63
63: ; preds = %61, %75
%64 = phi i64 [ 0, %61 ], [ %69, %75 ]
%65 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i32 %67)
%69 = add nuw nsw i64 %64, 1
%70 = trunc i64 %69 to i32
%71 = srem i32 %70, %2
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %63
%74 = call i32 @fputc(i32 10, i32* %11)
br label %75
75: ; preds = %63, %73
%76 = icmp eq i64 %69, %62
br i1 %76, label %23, label %63
77: ; preds = %23, %13
%78 = call i32 @fputc(i32 10, i32* %11)
%79 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i64 3, i64 1, i32* %11)
%80 = call i32 @fputc(i32 10, i32* %11)
%81 = call i32 @fputc(i32 10, i32* %11)
%82 = call i64 @fwrite(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0), i64 82, i64 1, i32* %11)
%83 = call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i64 16, i64 1, i32* %11)
%84 = call i64 @fwrite(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.17, i64 0, i64 0), i64 82, i64 1, i32* %11)
%85 = call i32 @fclose(i32* %11)
br label %86
86: ; preds = %10, %77
%87 = phi i32 [ 0, %77 ], [ -2, %10 ]
%88 = call i32 @fclose(i32* %8)
br label %89
89: ; preds = %4, %86
%90 = phi i32 [ %87, %86 ], [ -1, %4 ]
ret i32 %90
}