#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*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int dat2h(char *infname, char *outfname, char *struct_name) {
  int ret = 0;
  FILE *infile, *outfile;
  int i = 0;
  char *check;
  outfile = fopen(outfname, "w");
  if (outfile == (FILE *)NULL) {
    printf("Can't open write file %s \n", outfname);
    return -1;
  }
  fputs("/* AUTO GEN PLEASE DO NOT MODIFY IT */ \n", outfile);
  fputs("/* AUTO GEN PLEASE DO NOT MODIFY IT */ \n", outfile);
  fputs("\n", outfile);
  fputs("\n", outfile);
  infile = fopen(infname, "r");
  if (infile == (FILE *)NULL) {
    printf("Can't read file %s \n", infname);
    fprintf(outfile, "PUCHAR %s = NULL;\n", struct_name);
    fclose(outfile);
    return -1;
  }
  fprintf(outfile, "PUCHAR %s = \n", struct_name);
  while (1) {
    char c[512];
    fgets(c, 510, infile);
    if (feof(infile))
      break;
    if (strstr(c, "#The word of \"Default\"") != NULL)
      continue;
    if (c[strlen(c) - 1] == '\n')
      c[strlen(c) - 1] = '\0';
    fputc('"', outfile);
    strcat(c, "\\n\"");
    fputs(c, outfile);
    fputs("\n", outfile);
  }
  fputs(";\n", outfile);
  fclose(infile);
  fclose(outfile);
}


x86 assembly (clang, -O0):
<dat2h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1210 <dat2h+0x60>
mov    -0x18(%rbp),%rsi
lea    0xe03(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ae <dat2h+0x1fe>
mov    -0x38(%rbp),%rsi
lea    0xe02(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x38(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x38(%rbp),%rsi
lea    0xe09(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x38(%rbp),%rsi
lea    0xdf9(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x10(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12a8 <dat2h+0xf8>
mov    -0x10(%rbp),%rsi
lea    0xdce(%rip),%rdi
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdcf(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ae <dat2h+0x1fe>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdb9(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x250(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x1fe,%esi
call   1080 <fgets@plt>
mov    -0x30(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%rax
je     12e9 <dat2h+0x139>
jmp    138c <dat2h+0x1dc>
lea    -0x250(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     130b <dat2h+0x15b>
jmp    12bc <dat2h+0x10c>
lea    -0x250(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x250(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1346 <dat2h+0x196>
lea    -0x250(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x250(%rbp,%rax,1)
mov    -0x38(%rbp),%rsi
mov    $0x22,%edi
call   1070 <fputc@plt>
lea    -0x250(%rbp),%rdi
lea    0xd33(%rip),%rsi
call   10c0 <strcat@plt>
lea    -0x250(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <fputs@plt>
mov    -0x38(%rbp),%rsi
lea    0xcc2(%rip),%rdi
call   1060 <fputs@plt>
jmp    12bc <dat2h+0x10c>
mov    -0x38(%rbp),%rsi
lea    0xcd6(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dat2h>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0xe20(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12ab <dat2h+0xeb>
mov    %rax,%r14
lea    0xe22(%rip),%rbx
mov    $0x28,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %rax,%rcx
call   10d0 <fwrite@plt>
mov    $0x28,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %r14,%rcx
call   10d0 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
lea    0xe00(%rip),%rsi
mov    %r12,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12bc <dat2h+0xfc>
mov    %rax,%rbx
lea    0xe13(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1090 <fprintf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x1fe,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
je     12fb <dat2h+0x13b>
lea    0xdde(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    12dd <dat2h+0x11d>
lea    0xd50(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
jmp    12e5 <dat2h+0x125>
lea    0xd85(%rip),%rdi
mov    %r12,%rsi
call   1050 <printf@plt>
lea    0xd8b(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1090 <fprintf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    $0xffffffff,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xd7c(%rip),%r12
lea    0xd8c(%rip),%r13
jmp    1361 <dat2h+0x1a1>
nopl   0x0(%rax,%rax,1)
mov    $0x22,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   10c0 <strcat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    %r15,%rdi
mov    $0x1fe,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
jne    1288 <dat2h+0xc8>
mov    %r15,%rdi
mov    %r12,%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
jne    1340 <dat2h+0x180>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r15,1)
jne    1310 <dat2h+0x150>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r15,1)
jmp    1310 <dat2h+0x150>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [27 x i8] c"Can't open write file %s \0A\00"
@.str.2 = [41 x i8] c"/* AUTO GEN PLEASE DO NOT MODIFY IT */ \0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [21 x i8] c"Can't read file %s \0A\00"
@.str.6 = [19 x i8] c"PUCHAR %s = NULL;\0A\00"
@.str.7 = [14 x i8] c"PUCHAR %s = \0A\00"
@.str.8 = [23 x i8] c"#The word of \22Default\22\00"
@.str.9 = [4 x i8] c"\\n\22\00"
@.str.10 = [3 x i8] c";\0A\00"
define i32 @dat2h(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [512 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %8
store i32 0, i32* %11
%14 = load i8*, i8** %6
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %10
%16 = load i32*, i32** %10
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %3
%19 = load i8*, i8** %6
%20 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %19)
store i32 -1, i32* %4
br label %91
21: ; preds = %3
%22 = load i32*, i32** %10
%23 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32* %22)
%24 = load i32*, i32** %10
%25 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32* %24)
%26 = load i32*, i32** %10
%27 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32* %26)
%28 = load i32*, i32** %10
%29 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32* %28)
%30 = load i8*, i8** %5
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %31, i32** %9
%32 = load i32*, i32** %9
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %42
34: ; preds = %21
%35 = load i8*, i8** %5
%36 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %35)
%37 = load i32*, i32** %10
%38 = load i8*, i8** %7
%39 = call i32 @fprintf(i32* %37, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = load i32*, i32** %10
%41 = call i32 @fclose(i32* %40)
store i32 -1, i32* %4
br label %91
42: ; preds = %21
%43 = load i32*, i32** %10
%44 = load i8*, i8** %7
%45 = call i32 @fprintf(i32* %43, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %42, %58, %74
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%48 = load i32*, i32** %9
%49 = call i32 @fgets(i8* %47, i32 510, i32* %48)
%50 = load i32*, i32** %9
%51 = call i64 @feof(i32* %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %46
br label %84
54: ; preds = %46
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%56 = call i32* @strstr(i8* %55, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%57 = icmp ne i32* %56, null
br i1 %57, label %58, label %59
58: ; preds = %54
br label %46
59: ; preds = %54
%60 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%61 = call i32 @strlen(i8* %60)
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 10
br i1 %67, label %68, label %74
68: ; preds = %59
%69 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%70 = call i32 @strlen(i8* %69)
%71 = sub nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 %72
store i8 0, i8* %73
br label %74
74: ; preds = %68, %59
%75 = load i32*, i32** %10
%76 = call i32 @fputc(i8 signext 34, i32* %75)
%77 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%78 = call i32 @strcat(i8* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%80 = load i32*, i32** %10
%81 = call i32 @fputs(i8* %79, i32* %80)
%82 = load i32*, i32** %10
%83 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32* %82)
br label %46
84: ; preds = %53
%85 = load i32*, i32** %10
%86 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %85)
%87 = load i32*, i32** %9
%88 = call i32 @fclose(i32* %87)
%89 = load i32*, i32** %10
%90 = call i32 @fclose(i32* %89)
br label %91
91: ; preds = %84, %34, %18
%92 = load i32, i32* %4
ret i32 %92
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [27 x i8] c"Can't open write file %s \0A\00"
@.str.2 = [41 x i8] c"/* AUTO GEN PLEASE DO NOT MODIFY IT */ \0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [21 x i8] c"Can't read file %s \0A\00"
@.str.6 = [19 x i8] c"PUCHAR %s = NULL;\0A\00"
@.str.7 = [14 x i8] c"PUCHAR %s = \0A\00"
@.str.8 = [23 x i8] c"#The word of \22Default\22\00"
@.str.9 = [4 x i8] c"\\n\22\00"
@.str.10 = [3 x i8] c";\0A\00"
define i32 @dat2h(i8* %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %54
9: ; preds = %3
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i64 40, i64 1, i32* %5)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i64 40, i64 1, i32* %5)
%12 = tail call i32 bitcast (i32 (i8, i32*)* @fputc to i32 (i32, i32*)*)(i32 10, i32* %5)
%13 = tail call i32 bitcast (i32 (i8, i32*)* @fputc to i32 (i32, i32*)*)(i32 10, i32* %5)
%14 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %9
%17 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%18 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%19 = tail call i32 @fclose(i32* %5)
br label %54
20: ; preds = %9
%21 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%23 = call i32 @fgets(i8* %22, i32 510, i32* %14)
%24 = call i64 @feof(i32* %14)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %50
26: ; preds = %20, %46
%27 = call i32* @strstr(i8* %22, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %46
29: ; preds = %26
%30 = call i32 @strlen(i8* %22)
%31 = add nsw i32 %30, -1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 10
br i1 %35, label %36, label %41
36: ; preds = %29
%37 = call i32 @strlen(i8* %22)
%38 = add nsw i32 %37, -1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %39
store i8 0, i8* %40
br label %41
41: ; preds = %36, %29
%42 = call i32 @fputc(i8 signext 34, i32* %5)
%43 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%44 = call i32 @fputs(i8* %22, i32* %5)
%45 = call i32 bitcast (i32 (i8, i32*)* @fputc to i32 (i32, i32*)*)(i32 10, i32* %5)
br label %46
46: ; preds = %26, %41
%47 = call i32 @fgets(i8* %22, i32 510, i32* %14)
%48 = call i64 @feof(i32* %14)
%49 = icmp eq i64 %48, 0
br i1 %49, label %26, label %50
50: ; preds = %46, %20
%51 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i64 2, i64 1, i32* %5)
%52 = call i32 @fclose(i32* %14)
%53 = call i32 @fclose(i32* %5)
br label %54
54: ; preds = %50, %16, %7
ret i32 -1
}