#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 */
struct dirent {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ create_sprite(char *, struct dirent *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char **argv) {
  char *dest_file_name;
  DIR *dir;
  FILE *out_fptr;
  struct dirent *object;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s dir_path [output_file_path]\n", argv[0]);
    exit(-1);
  }
  fprintf(stderr, "@@@ BMP to C code converter @@@\n Version 1.0");
  if (!(dir = opendir(argv[1]))) {
    fprintf(stderr, " ERROR: Unable to open directory \"%s\"\n", argv[1]);
    exit(-1);
  }
  if (argc >= 3) {
    if ((dest_file_name = (char *)calloc(sizeof(char), strlen(argv[2]) + 3)) ==
        NULL) {
      printf(" ERROR: Memory allocation failed. Exiting.\n");
      exit(-1);
    }
    strncpy(dest_file_name, argv[2], strlen(argv[2]));
  } else {
    if ((dest_file_name = (char *)calloc(sizeof(char), 15)) == NULL) {
      printf(" ERROR: Memory allocation failed. Exiting.\n");
      exit(-1);
    }
    strncpy(dest_file_name, "sprite_table.c", 14);
  }
  if ((out_fptr = fopen(dest_file_name, "w")) == NULL) {
    fprintf(stderr, " ERROR: Unable to open C file \"%s\"\n", dest_file_name);
    exit(-1);
  } else {
    fprintf(stderr, "Writing to \"%s\".\n\n", dest_file_name);
  }
  fwrite("/*************************************************************/\n", 1,
         64, out_fptr);
  fwrite("/** This sprite collection file was generated automatically **/\n", 1,
         64, out_fptr);
  fwrite("/**  by using BMP to C code converter written in 2019 by ...**/\n", 1,
         64, out_fptr);
  fwrite("/**  Ilya Levitsky                                          **/\n", 1,
         64, out_fptr);
  fwrite("/*************************************************************/\n\n",
         1, 65, out_fptr);
  fwrite("#include <stdint.h>\n", 1, 20, out_fptr);
  fwrite("#include \"oled_driver.h\"\n\n", 1, 26, out_fptr);
  while ((object = readdir(dir)) != NULL) {
    create_sprite(argv[1], object, out_fptr);
  }
  free(dest_file_name);
  fclose(out_fptr);
  fprintf(stderr, "Done!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1218 <main+0x48>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1273 <main+0xa3>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jl     12f2 <main+0x122>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <strlen@plt>
mov    %eax,%esi
add    $0x3,%esi
mov    $0x1,%edi
call   10a0 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12bd <main+0xed>
lea    0xdcd(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
jmp    133a <main+0x16a>
mov    $0x1,%edi
mov    $0xf,%esi
call   10a0 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1325 <main+0x155>
lea    0xd65(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xd77(%rip),%rsi
mov    $0xe,%edx
call   1040 <strncpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xd71(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    137d <main+0x1ad>
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xd4c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xd4b(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x28(%rbp),%rcx
lea    0xd4c(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
call   10f0 <fwrite@plt>
mov    -0x28(%rbp),%rcx
lea    0xd73(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
call   10f0 <fwrite@plt>
mov    -0x28(%rbp),%rcx
lea    0xd9a(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
call   10f0 <fwrite@plt>
mov    -0x28(%rbp),%rcx
lea    0xdc1(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
call   10f0 <fwrite@plt>
mov    -0x28(%rbp),%rcx
lea    0xde8(%rip),%rdi
mov    $0x1,%esi
mov    $0x41,%edx
call   10f0 <fwrite@plt>
mov    -0x28(%rbp),%rcx
lea    0xe10(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
call   10f0 <fwrite@plt>
mov    -0x28(%rbp),%rcx
lea    0xe0b(%rip),%rdi
mov    $0x1,%esi
mov    $0x1a,%edx
call   10f0 <fwrite@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     147f <main+0x2af>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1090 <create_sprite@plt>
jmp    144e <main+0x27e>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2b48(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x2dfb(%rip),%r13
mov    0x0(%r13),%edi
cmp    $0x1,%ebx
jle    13ac <main+0x1dc>
lea    0xe2e(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x8(%r14),%rdi
call   1070 <opendir@plt>
test   %rax,%rax
je     13b8 <main+0x1e8>
mov    %rax,%r12
cmp    $0x3,%ebx
jb     1252 <main+0x82>
mov    0x10(%r14),%rdi
call   1080 <strlen@plt>
lea    0x3(%rax),%esi
mov    $0x1,%edi
call   10a0 <calloc@plt>
test   %rax,%rax
je     13c9 <main+0x1f9>
mov    %rax,%r15
mov    0x10(%r14),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
jmp    127c <main+0xac>
mov    $0x1,%edi
mov    $0xf,%esi
call   10a0 <calloc@plt>
test   %rax,%rax
je     13c9 <main+0x1f9>
mov    %rax,%r15
lea    0xe07(%rip),%rsi
mov    %rax,%rdi
mov    $0xe,%edx
call   1040 <strncpy@plt>
lea    0xe02(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
mov    0x0(%r13),%edi
test   %rax,%rax
je     13df <main+0x20f>
mov    %rax,%rbx
lea    0xe09(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xe33(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xe5b(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xe83(%rip),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xeab(%rip),%rdi
mov    $0x1,%esi
mov    $0x41,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xed4(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xed0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1a,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
mov    %r12,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     137e <main+0x1ae>
mov    0x8(%r14),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1090 <create_sprite@plt>
jmp    1360 <main+0x190>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x0(%r13),%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    (%r14),%rdx
lea    0xc4a(%rip),%rsi
jmp    13e9 <main+0x219>
mov    0x0(%r13),%edi
mov    0x8(%r14),%rdx
lea    0xc8d(%rip),%rsi
jmp    13e9 <main+0x219>
lea    0xe70(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
lea    0xca6(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
@stderr = global i32 0
@.str = [39 x i8] c"Usage: %s dir_path [output_file_path]\0A\00"
@.str.1 = [45 x i8] c"@@@ BMP to C code converter @@@\0A Version 1.0\00"
@.str.2 = [39 x i8] c" ERROR: Unable to open directory \22%s\22\0A\00"
@.str.3 = [44 x i8] c" ERROR: Memory allocation failed. Exiting.\0A\00"
@.str.4 = [15 x i8] c"sprite_table.c\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [36 x i8] c" ERROR: Unable to open C file \22%s\22\0A\00"
@.str.7 = [19 x i8] c"Writing to \22%s\22.\0A\0A\00"
@.str.8 = [65 x i8] c"/*************************************************************/\0A\00"
@.str.9 = [65 x i8] c"/** This sprite collection file was generated automatically **/\0A\00"
@.str.10 = [65 x i8] c"/** by using BMP to C code converter written in 2019 by ...**/\0A\00"
@.str.11 = [65 x i8] c"/** Ilya Levitsky **/\0A\00"
@.str.12 = [66 x i8] c"/*************************************************************/\0A\0A\00"
@.str.13 = [21 x i8] c"#include <stdint.h>\0A\00"
@.str.14 = [27 x i8] c"#include \22oled_driver.h\22\0A\0A\00"
@.str.15 = [7 x i8] c"Done!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca %struct.dirent*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @opendir(i8* %24)
store i32* %25, i32** %7
%26 = icmp ne i32* %25, null
br i1 %26, label %34, label %27
27: ; preds = %19
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 -1)
unreachable
34: ; preds = %19
%35 = load i32, i32* %4
%36 = icmp sge i32 %35, 3
br i1 %36, label %37, label %59
37: ; preds = %34
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 @strlen(i8* %40)
%42 = add nsw i32 %41, 3
%43 = call i64 @calloc(i32 1, i32 %42)
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %6
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %49
46: ; preds = %37
%47 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%48 = call i32 @exit(i32 -1)
unreachable
49: ; preds = %37
%50 = load i8*, i8** %6
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 2
%56 = load i8*, i8** %55
%57 = call i32 @strlen(i8* %56)
%58 = call i32 @strncpy(i8* %50, i8* %53, i32 %57)
br label %69
59: ; preds = %34
%60 = call i64 @calloc(i32 1, i32 15)
%61 = inttoptr i64 %60 to i8*
store i8* %61, i8** %6
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%65 = call i32 @exit(i32 -1)
unreachable
66: ; preds = %59
%67 = load i8*, i8** %6
%68 = call i32 @strncpy(i8* %67, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 14)
br label %69
69: ; preds = %66, %49
%70 = load i8*, i8** %6
%71 = call i32* @fopen(i8* %70, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %71, i32** %8
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %78
73: ; preds = %69
%74 = load i32, i32* @stderr
%75 = load i8*, i8** %6
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* %75)
%77 = call i32 @exit(i32 -1)
unreachable
78: ; preds = %69
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %6
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %78
%83 = load i32*, i32** %8
%84 = call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.8, i64 0, i64 0), i32 1, i32 64, i32* %83)
%85 = load i32*, i32** %8
%86 = call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), i32 1, i32 64, i32* %85)
%87 = load i32*, i32** %8
%88 = call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0), i32 1, i32 64, i32* %87)
%89 = load i32*, i32** %8
%90 = call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 64, i32* %89)
%91 = load i32*, i32** %8
%92 = call i32 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0), i32 1, i32 65, i32* %91)
%93 = load i32*, i32** %8
%94 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 1, i32 20, i32* %93)
%95 = load i32*, i32** %8
%96 = call i32 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0), i32 1, i32 26, i32* %95)
br label %97
97: ; preds = %101, %82
%98 = load i32*, i32** %7
%99 = call %struct.dirent* @readdir(i32* %98)
store %struct.dirent* %99, %struct.dirent** %9
%100 = icmp ne %struct.dirent* %99, null
br i1 %100, label %101, label %108
101: ; preds = %97
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 1
%104 = load i8*, i8** %103
%105 = load %struct.dirent*, %struct.dirent** %9
%106 = load i32*, i32** %8
%107 = call i32 @create_sprite(i8* %104, %struct.dirent* %105, i32* %106)
br label %97
108: ; preds = %97
%109 = load i8*, i8** %6
%110 = call i32 @free(i8* %109)
%111 = load i32*, i32** %8
%112 = call i32 @fclose(i32* %111)
%113 = load i32, i32* @stderr
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@stderr = global i32 0
@.str = [39 x i8] c"Usage: %s dir_path [output_file_path]\0A\00"
@.str.1 = [45 x i8] c"@@@ BMP to C code converter @@@\0A Version 1.0\00"
@.str.2 = [39 x i8] c" ERROR: Unable to open directory \22%s\22\0A\00"
@.str.4 = [15 x i8] c"sprite_table.c\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [36 x i8] c" ERROR: Unable to open C file \22%s\22\0A\00"
@.str.7 = [19 x i8] c"Writing to \22%s\22.\0A\0A\00"
@.str.8 = [65 x i8] c"/*************************************************************/\0A\00"
@.str.9 = [65 x i8] c"/** This sprite collection file was generated automatically **/\0A\00"
@.str.10 = [65 x i8] c"/** by using BMP to C code converter written in 2019 by ...**/\0A\00"
@.str.11 = [65 x i8] c"/** Ilya Levitsky **/\0A\00"
@.str.12 = [66 x i8] c"/*************************************************************/\0A\0A\00"
@.str.13 = [21 x i8] c"#include <stdint.h>\0A\00"
@.str.14 = [27 x i8] c"#include \22oled_driver.h\22\0A\0A\00"
@.str.15 = [7 x i8] c"Done!\0A\00"
@str.16 = [43 x i8] c" ERROR: Memory allocation failed. Exiting.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
%4 = load i32, i32* @stderr
br i1 %3, label %5, label %9
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @opendir(i8* %12)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %11
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %9
%21 = icmp ugt i32 %0, 2
br i1 %21, label %22, label %37
22: ; preds = %20
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = tail call i32 @strlen(i8* %24)
%26 = add nsw i32 %25, 3
%27 = tail call i64 @calloc(i32 1, i32 %26)
%28 = inttoptr i64 %27 to i8*
%29 = icmp eq i64 %27, 0
br i1 %29, label %30, label %33
30: ; preds = %22
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.16, i64 0, i64 0))
%32 = tail call i32 @exit(i32 -1)
unreachable
33: ; preds = %22
%34 = load i8*, i8** %23
%35 = tail call i32 @strlen(i8* %34)
%36 = tail call i32 @strncpy(i8* %28, i8* %34, i32 %35)
br label %46
37: ; preds = %20
%38 = tail call i64 @calloc(i32 1, i32 15)
%39 = inttoptr i64 %38 to i8*
%40 = icmp eq i64 %38, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.16, i64 0, i64 0))
%43 = tail call i32 @exit(i32 -1)
unreachable
44: ; preds = %37
%45 = tail call i32 @strncpy(i8* %39, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 14)
br label %46
46: ; preds = %44, %33
%47 = phi i8* [ %28, %33 ], [ %39, %44 ]
%48 = tail call i32* @fopen(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i32* %48, null
%50 = load i32, i32* @stderr
br i1 %49, label %51, label %54
51: ; preds = %46
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* %47)
%53 = tail call i32 @exit(i32 -1)
unreachable
54: ; preds = %46
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %47)
%56 = tail call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.8, i64 0, i64 0), i32 1, i32 64, i32* %48)
%57 = tail call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), i32 1, i32 64, i32* %48)
%58 = tail call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0), i32 1, i32 64, i32* %48)
%59 = tail call i32 @fwrite(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 64, i32* %48)
%60 = tail call i32 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0), i32 1, i32 65, i32* %48)
%61 = tail call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 1, i32 20, i32* %48)
%62 = tail call i32 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0), i32 1, i32 26, i32* %48)
%63 = tail call %struct.dirent* @readdir(i32* %13)
%64 = icmp eq %struct.dirent* %63, null
br i1 %64, label %71, label %65
65: ; preds = %54, %65
%66 = phi %struct.dirent* [ %69, %65 ], [ %63, %54 ]
%67 = load i8*, i8** %11
%68 = tail call i32 @create_sprite(i8* %67, %struct.dirent* %66, i32* %48)
%69 = tail call %struct.dirent* @readdir(i32* %13)
%70 = icmp eq %struct.dirent* %69, null
br i1 %70, label %71, label %65
71: ; preds = %65, %54
%72 = tail call i32 @free(i8* %47)
%73 = tail call i32 @fclose(i32* %48)
%74 = load i32, i32* @stderr
%75 = tail call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}