#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ isalnum(char);
scalar_t__ malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
int strlen(char *);
char *strrchr(char *, char);
int main(int argc, char *argv[]) {
  printf("%s %s (%s)\n", "File2Code", "0.2", "Mar 18 2022");
  printf("(c) %s by %s\n\n", "2013-2014", "Stephan Laukien");
  if (argc == 1) {
    fprintf(stderr, "ERROR: no argument");
    return EXIT_FAILURE;
  }
  char *filename = strdup(argv[1]);
  int fd;
  fd = open(filename, O_RDONLY);
  if (fd == -1) {
    fprintf(stderr, "ERROR: unable to read file (%s)", filename);
    free(filename);
    return EXIT_FAILURE;
  }
  char *sep;
  sep = strrchr(filename, '/');
  if (!sep) {
    sep = filename;
  }
  char *codename = (char *)malloc(strlen(sep) + 2 + 1);
  strcpy(codename, filename);
  strcat(codename, ".c");
  FILE *code;
  code = fopen(codename, "w");
  if (!code) {
    fprintf(stderr, "ERROR: unable to create file (%s)", codename);
    close(fd);
    free(codename);
    free(filename);
    return EXIT_FAILURE;
  }
  char *charname = strdup(sep);
  int i;
  for (i = 0; i < strlen(charname); ++i) {
    if (!isalnum(charname[i])) {
      charname[i] = '_';
    }
  }
  fprintf(code, "unsigned char %s_data[] = {\n", charname);
  char buf[1024];
  int len;
  unsigned long size = 0;
  while ((len = read(fd, buf, 1024))) {
    if (len == 0) {
      break;
    }
    int i;
    for (i = 0; i < len; ++i) {
      fprintf(code, "%d", buf[i]);
      if (len != 1024 && i < len - 1) {
        fprintf(code, ", ");
      }
    }
    size += len;
  }
  fprintf(code, "\n};\n");
  fprintf(code, "unsigned long %s_size = %ld;\n", charname, size);
  printf("CREATE: %s (%ld)\n", codename, size);
  fclose(code);
  close(fd);
  free(charname);
  free(codename);
  free(filename);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdf0(%rip),%rdi
lea    0xdf5(%rip),%rsi
lea    0xdf8(%rip),%rdx
lea    0xdf5(%rip),%rcx
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdf3(%rip),%rdi
lea    0xdfb(%rip),%rsi
lea    0xdfe(%rip),%rdx
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    127b <main+0x8b>
mov    0x2d7f(%rip),%rax
movslq (%rax),%rdi
lea    0xdec(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    0x2d5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1591 <main+0x3a1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1110 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
call   10e0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12e1 <main+0xf1>
mov    0x2d26(%rip),%rax
movslq (%rax),%rdi
mov    -0x18(%rbp),%rdx
lea    0xda2(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2cf9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1591 <main+0x3a1>
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1090 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1306 <main+0x116>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
add    $0x2,%edi
add    $0x1,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x30(%rbp),%rdi
lea    0xd3d(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    13a3 <main+0x1b3>
mov    0x2c75(%rip),%rax
movslq (%rax),%rdi
mov    -0x30(%rbp),%rdx
lea    0xd16(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2c37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1591 <main+0x3a1>
mov    -0x28(%rbp),%rdi
call   1110 <strdup@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x468(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x468(%rbp),%eax
cmp    %ecx,%eax
jge    1412 <main+0x222>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1080 <isalnum@plt>
cmp    $0x0,%eax
jne    13ff <main+0x20f>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movb   $0x5f,(%rax,%rcx,1)
jmp    1404 <main+0x214>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    13b7 <main+0x1c7>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xc88(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
movq   $0x0,-0x460(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
mov    %eax,-0x454(%rbp)
cmp    $0x0,%eax
je     1511 <main+0x321>
cmpl   $0x0,-0x454(%rbp)
jne    1468 <main+0x278>
jmp    1511 <main+0x321>
movl   $0x0,-0x464(%rbp)
mov    -0x464(%rbp),%eax
cmp    -0x454(%rbp),%eax
jge    14f7 <main+0x307>
mov    -0x38(%rbp),%rdi
movslq -0x464(%rbp),%rax
movsbl -0x450(%rbp,%rax,1),%edx
ff
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
cmpl   $0x400,-0x454(%rbp)
je     14de <main+0x2ee>
mov    -0x464(%rbp),%eax
mov    -0x454(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14de <main+0x2ee>
mov    -0x38(%rbp),%rdi
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    14e3 <main+0x2f3>
mov    -0x464(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x464(%rbp)
jmp    1472 <main+0x282>
movslq -0x454(%rbp),%rax
add    -0x460(%rbp),%rax
mov    %rax,-0x460(%rbp)
jmp    1433 <main+0x243>
mov    -0x38(%rbp),%rdi
lea    0xbb0(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x460(%rbp),%rcx
lea    0xb98(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x30(%rbp),%rsi
mov    -0x460(%rbp),%rdx
lea    0xb9d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2a3c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xde3(%rip),%rdi
lea    0xde8(%rip),%rsi
lea    0xdeb(%rip),%rdx
lea    0xde8(%rip),%rcx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xde6(%rip),%rdi
lea    0xdee(%rip),%rsi
lea    0xdf1(%rip),%rdx
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0x1,%ebp
jne    127f <main+0x7f>
mov    0x2d77(%rip),%rax
movslq (%rax),%rcx
lea    0xde4(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
call   1110 <fwrite@plt>
jmp    1508 <main+0x308>
mov    0x8(%rbx),%rdi
call   1120 <strdup@plt>
mov    %rax,%r14
mov    0x2d56(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10e0 <open@plt>
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
je     14b7 <main+0x2b7>
mov    %r14,%rdi
mov    $0x2f,%esi
call   1090 <strrchr@plt>
test   %rax,%rax
mov    %r14,%rbp
cmovne %rax,%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
lea    0x3(%rax),%edi
call   10d0 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
lea    0xd9d(%rip),%rsi
mov    %r15,%rdi
call   1100 <strcat@plt>
lea    0xd91(%rip),%rsi
mov    %r15,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     14d4 <main+0x2d4>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1120 <strdup@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1358 <main+0x158>
xor    %ebp,%ebp
jmp    1343 <main+0x143>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbp
mov    %r12,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1358 <main+0x158>
movsbl (%r12,%rbp,1),%edi
call   1080 <isalnum@plt>
test   %eax,%eax
jne    1330 <main+0x130>
movb   $0x5f,(%r12,%rbp,1)
jmp    1330 <main+0x130>
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
lea    0xd40(%rip),%rsi
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %r12,0x10(%rsp)
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
lea    0x30(%rsp),%rsi
mov    0xc(%rsp),%edi
mov    $0x400,%edx
call   10b0 <read@plt>
test   %eax,%eax
je     1435 <main+0x235>
mov    %eax,%r12d
lea    0xd24(%rip),%r14
xor    %ebp,%ebp
jmp    13d5 <main+0x1d5>
cs nopw 0x0(%rax,%rax,1)
movslq %r12d,%rax
mov    0x28(%rsp),%rbp
add    %rax,%rbp
mov    0xc(%rsp),%edi
lea    0x30(%rsp),%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
mov    %eax,%r12d
test   %eax,%eax
je     1435 <main+0x235>
mov    %rbp,0x28(%rsp)
test   %r12d,%r12d
jle    13b0 <main+0x1b0>
lea    -0x1(%r12),%r13d
mov    %r12d,%ebp
xor    %r15d,%r15d
jmp    13f9 <main+0x1f9>
nopl   0x0(%rax)
add    $0x1,%r15
cmp    %r15,%rbp
je     13b0 <main+0x1b0>
movsbl 0x30(%rsp,%r15,1),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
cmp    $0x400,%r12d
je     13f0 <main+0x1f0>
cmp    %r13,%r15
jae    13f0 <main+0x1f0>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xc9e(%rip),%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
jmp    13f0 <main+0x1f0>
lea    0xc90(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xc7c(%rip),%rsi
mov    %rbx,%rdi
mov    0x10(%rsp),%r14
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   10c0 <fprintf@plt>
lea    0xc7e(%rip),%rdi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0xc(%rsp),%edi
call   10a0 <close@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x2b13(%rip),%rax
jmp    150f <main+0x30f>
mov    0x2b1a(%rip),%rax
movslq (%rax),%rdi
lea    0xb9a(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    1500 <main+0x300>
mov    0x2afd(%rip),%rax
movslq (%rax),%rdi
lea    0xba2(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    0xc(%rsp),%edi
call   10a0 <close@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x2ac1(%rip),%rax
mov    (%rax),%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s %s (%s)\0A\00"
@.str.1 = [10 x i8] c"File2Code\00"
@.str.2 = [4 x i8] c"0.2\00"
@.str.3 = [12 x i8] c"Mar 18 2022\00"
@.str.4 = [15 x i8] c"(c) %s by %s\0A\0A\00"
@.str.5 = [10 x i8] c"2013-2014\00"
@.str.6 = [16 x i8] c"Stephan Laukien\00"
@stderr = global i32 0
@.str.7 = [19 x i8] c"ERROR: no argument\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.8 = [32 x i8] c"ERROR: unable to read file (%s)\00"
@.str.9 = [3 x i8] c".c\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [34 x i8] c"ERROR: unable to create file (%s)\00"
@.str.12 = [29 x i8] c"unsigned char %s_data[] = {\0A\00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [3 x i8] c", \00"
@.str.15 = [5 x i8] c"\0A};\0A\00"
@.str.16 = [30 x i8] c"unsigned long %s_size = %ld;\0A\00"
@.str.17 = [18 x i8] c"CREATE: %s (%ld)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca [1024 x i8]
%14 = alloca i32
%15 = alloca i64
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%26 = load i32, i32* @EXIT_FAILURE
store i32 %26, i32* %3
br label %173
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i8* @strdup(i8* %30)
store i8* %31, i8** %6
%32 = load i8*, i8** %6
%33 = load i32, i32* @O_RDONLY
%34 = call i32 @open(i8* %32, i32 %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %46
37: ; preds = %27
%38 = load i32, i32* @stderr
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to i32*
%41 = load i8*, i8** %6
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %6
%44 = call i32 @free(i8* %43)
%45 = load i32, i32* @EXIT_FAILURE
store i32 %45, i32* %3
br label %173
46: ; preds = %27
%47 = load i8*, i8** %6
%48 = call i8* @strrchr(i8* %47, i8 signext 47)
store i8* %48, i8** %8
%49 = load i8*, i8** %8
%50 = icmp ne i8* %49, null
br i1 %50, label %53, label %51
51: ; preds = %46
%52 = load i8*, i8** %6
store i8* %52, i8** %8
br label %53
53: ; preds = %51, %46
%54 = load i8*, i8** %8
%55 = call i32 @strlen(i8* %54)
%56 = add nsw i32 %55, 2
%57 = add nsw i32 %56, 1
%58 = call i64 @malloc(i32 %57)
%59 = inttoptr i64 %58 to i8*
store i8* %59, i8** %9
%60 = load i8*, i8** %9
%61 = load i8*, i8** %6
%62 = call i32 @strcpy(i8* %60, i8* %61)
%63 = load i8*, i8** %9
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%65 = load i8*, i8** %9
%66 = call i32* @fopen(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %66, i32** %10
%67 = load i32*, i32** %10
%68 = icmp ne i32* %67, null
br i1 %68, label %82, label %69
69: ; preds = %53
%70 = load i32, i32* @stderr
%71 = sext i32 %70 to i64
%72 = inttoptr i64 %71 to i32*
%73 = load i8*, i8** %9
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* %73)
%75 = load i32, i32* %7
%76 = call i32 @close(i32 %75)
%77 = load i8*, i8** %9
%78 = call i32 @free(i8* %77)
%79 = load i8*, i8** %6
%80 = call i32 @free(i8* %79)
%81 = load i32, i32* @EXIT_FAILURE
store i32 %81, i32* %3
br label %173
82: ; preds = %53
%83 = load i8*, i8** %8
%84 = call i8* @strdup(i8* %83)
store i8* %84, i8** %11
store i32 0, i32* %12
br label %85
85: ; preds = %104, %82
%86 = load i32, i32* %12
%87 = load i8*, i8** %11
%88 = call i32 @strlen(i8* %87)
%89 = icmp slt i32 %86, %88
br i1 %89, label %90, label %107
90: ; preds = %85
%91 = load i8*, i8** %11
%92 = load i32, i32* %12
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
%95 = load i8, i8* %94
%96 = call i32 @isalnum(i8 signext %95)
%97 = icmp ne i32 %96, 0
br i1 %97, label %103, label %98
98: ; preds = %90
%99 = load i8*, i8** %11
%100 = load i32, i32* %12
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %99, i64 %101
store i8 95, i8* %102
br label %103
103: ; preds = %98, %90
br label %104
104: ; preds = %103
%105 = load i32, i32* %12
%106 = add nsw i32 %105, 1
store i32 %106, i32* %12
br label %85
107: ; preds = %85
%108 = load i32*, i32** %10
%109 = load i8*, i8** %11
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %108, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %109)
store i64 0, i64* %15
br label %111
111: ; preds = %147, %107
%112 = load i32, i32* %7
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%114 = call i32 @read(i32 %112, i8* %113, i32 1024)
store i32 %114, i32* %14
%115 = icmp ne i32 %114, 0
br i1 %115, label %116, label %152
116: ; preds = %111
%117 = load i32, i32* %14
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %120
119: ; preds = %116
br label %152
120: ; preds = %116
store i32 0, i32* %16
br label %121
121: ; preds = %144, %120
%122 = load i32, i32* %16
%123 = load i32, i32* %14
%124 = icmp slt i32 %122, %123
br i1 %124, label %125, label %147
125: ; preds = %121
%126 = load i32*, i32** %10
%127 = load i32, i32* %16
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = call i32 (i32*, i8*, ...) @fprintf(i32* %126, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %131)
%133 = load i32, i32* %14
%134 = icmp ne i32 %133, 1024
br i1 %134, label %135, label %143
135: ; preds = %125
%136 = load i32, i32* %16
%137 = load i32, i32* %14
%138 = sub nsw i32 %137, 1
%139 = icmp slt i32 %136, %138
br i1 %139, label %140, label %143
140: ; preds = %135
%141 = load i32*, i32** %10
%142 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
br label %143
143: ; preds = %140, %135, %125
br label %144
144: ; preds = %143
%145 = load i32, i32* %16
%146 = add nsw i32 %145, 1
store i32 %146, i32* %16
br label %121
147: ; preds = %121
%148 = load i32, i32* %14
%149 = sext i32 %148 to i64
%150 = load i64, i64* %15
%151 = add i64 %150, %149
store i64 %151, i64* %15
br label %111
152: ; preds = %119, %111
%153 = load i32*, i32** %10
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %153, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%155 = load i32*, i32** %10
%156 = load i8*, i8** %11
%157 = load i64, i64* %15
%158 = call i32 (i32*, i8*, ...) @fprintf(i32* %155, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i8* %156, i64 %157)
%159 = load i8*, i8** %9
%160 = load i64, i64* %15
%161 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8* %159, i64 %160)
%162 = load i32*, i32** %10
%163 = call i32 @fclose(i32* %162)
%164 = load i32, i32* %7
%165 = call i32 @close(i32 %164)
%166 = load i8*, i8** %11
%167 = call i32 @free(i8* %166)
%168 = load i8*, i8** %9
%169 = call i32 @free(i8* %168)
%170 = load i8*, i8** %6
%171 = call i32 @free(i8* %170)
%172 = load i32, i32* @EXIT_SUCCESS
store i32 %172, i32* %3
br label %173
173: ; preds = %152, %69, %37, %21
%174 = load i32, i32* %3
ret i32 %174
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s %s (%s)\0A\00"
@.str.1 = [10 x i8] c"File2Code\00"
@.str.2 = [4 x i8] c"0.2\00"
@.str.3 = [12 x i8] c"Mar 18 2022\00"
@.str.4 = [15 x i8] c"(c) %s by %s\0A\0A\00"
@.str.5 = [10 x i8] c"2013-2014\00"
@.str.6 = [16 x i8] c"Stephan Laukien\00"
@stderr = global i32 0
@.str.7 = [19 x i8] c"ERROR: no argument\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.8 = [32 x i8] c"ERROR: unable to read file (%s)\00"
@.str.9 = [3 x i8] c".c\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [34 x i8] c"ERROR: unable to create file (%s)\00"
@.str.12 = [29 x i8] c"unsigned char %s_data[] = {\0A\00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [3 x i8] c", \00"
@.str.15 = [5 x i8] c"\0A};\0A\00"
@.str.16 = [30 x i8] c"unsigned long %s_size = %ld;\0A\00"
@.str.17 = [18 x i8] c"CREATE: %s (%ld)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%6 = icmp eq i32 %0, 1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i64 18, i64 1, i32* %10)
%12 = load i32, i32* @EXIT_FAILURE
br label %107
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i8* @strdup(i8* %15)
%17 = load i32, i32* @O_RDONLY
%18 = tail call i32 @open(i8* %16, i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %16)
%25 = tail call i32 @free(i8* %16)
%26 = load i32, i32* @EXIT_FAILURE
br label %107
27: ; preds = %13
%28 = tail call i8* @strrchr(i8* dereferenceable(1) %16, i8 signext 47)
%29 = icmp eq i8* %28, null
%30 = select i1 %29, i8* %16, i8* %28
%31 = tail call i32 @strlen(i8* %30)
%32 = add nsw i32 %31, 3
%33 = tail call i64 @malloc(i32 %32)
%34 = inttoptr i64 %33 to i8*
%35 = tail call i32 @strcpy(i8* %34, i8* %16)
%36 = tail call i32 @strcat(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%37 = tail call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %48
39: ; preds = %27
%40 = load i32, i32* @stderr
%41 = sext i32 %40 to i64
%42 = inttoptr i64 %41 to i32*
%43 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* %34)
%44 = tail call i32 @close(i32 %18)
%45 = tail call i32 @free(i8* %34)
%46 = tail call i32 @free(i8* %16)
%47 = load i32, i32* @EXIT_FAILURE
br label %107
48: ; preds = %27
%49 = tail call i8* @strdup(i8* %30)
%50 = tail call i32 @strlen(i8* %49)
%51 = icmp sgt i32 %50, 0
br i1 %51, label %52, label %64
52: ; preds = %48, %59
%53 = phi i64 [ %60, %59 ], [ 0, %48 ]
%54 = getelementptr inbounds i8, i8* %49, i64 %53
%55 = load i8, i8* %54
%56 = tail call i32 @isalnum(i8 signext %55)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %52
store i8 95, i8* %54
br label %59
59: ; preds = %52, %58
%60 = add nuw nsw i64 %53, 1
%61 = tail call i32 @strlen(i8* %49)
%62 = sext i32 %61 to i64
%63 = icmp slt i64 %60, %62
br i1 %63, label %52, label %64
64: ; preds = %59, %48
%65 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %49)
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%67 = call i32 @read(i32 %18, i8* %66, i32 1024)
%68 = icmp eq i32 %67, 0
br i1 %68, label %96, label %69
69: ; preds = %64, %91
%70 = phi i32 [ %94, %91 ], [ %67, %64 ]
%71 = phi i64 [ %93, %91 ], [ 0, %64 ]
%72 = icmp sgt i32 %70, 0
br i1 %72, label %73, label %91
73: ; preds = %69
%74 = icmp ne i32 %70, 1024
%75 = add nsw i32 %70, -1
%76 = zext i32 %75 to i64
%77 = zext i32 %70 to i64
br label %78
78: ; preds = %73, %88
%79 = phi i64 [ 0, %73 ], [ %89, %88 ]
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %82)
%84 = icmp ult i64 %79, %76
%85 = select i1 %74, i1 %84, i1 false
br i1 %85, label %86, label %88
86: ; preds = %78
%87 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i64 2, i64 1, i32* %37)
br label %88
88: ; preds = %78, %86
%89 = add nuw nsw i64 %79, 1
%90 = icmp eq i64 %89, %77
br i1 %90, label %91, label %78
91: ; preds = %88, %69
%92 = sext i32 %70 to i64
%93 = add i64 %71, %92
%94 = call i32 @read(i32 %18, i8* %66, i32 1024)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %69
96: ; preds = %91, %64
%97 = phi i64 [ 0, %64 ], [ %93, %91 ]
%98 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i64 4, i64 1, i32* %37)
%99 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i8* %49, i64 %97)
%100 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8* %34, i64 %97)
%101 = tail call i32 @fclose(i32* %37)
%102 = tail call i32 @close(i32 %18)
%103 = tail call i32 @free(i8* %49)
%104 = tail call i32 @free(i8* %34)
%105 = tail call i32 @free(i8* %16)
%106 = load i32, i32* @EXIT_SUCCESS
br label %107
107: ; preds = %20, %96, %39, %7
%108 = phi i32 [ %12, %7 ], [ %26, %20 ], [ %106, %96 ], [ %47, %39 ]
ret i32 %108
}