#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*/ fprintf(int /*<<< orphan*/ *, char *, char const *, char *);
int /*<<< orphan*/ memcpy(char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strlen(char const *);
char *strrchr(char const *, char);
void printHeader(FILE *out, const char *var_name) {
  size_t i;
  const char *p;
  char varNameBuf[256];
  memset(varNameBuf, 0, 256);
  p = strrchr(var_name, '/');
  if (p)
    var_name = p + 1;
  memcpy(varNameBuf, var_name, strlen(var_name));
  for (i = 0; i < 256; i++) {
    if (varNameBuf[i] == '\0')
      break;
    if (varNameBuf[i] == '.' || varNameBuf[i] == '-')
      varNameBuf[i] = '_';
  }
  fprintf(
      out,
      "/*===============================================================*\n"
      "   This file is automatically generated by wopn2hpp.sh script\n"
      "   PLEASE DON'T EDIT THIS DIRECTLY. Edit the %s file first,\n"
      "   and then run a wopn2hpp tool to generate this file again\n"
      " *===============================================================*/\n\n"
      "static unsigned char g_%s_bank[] = \n"
      "{\n",
      var_name, varNameBuf);
}


x86 assembly (clang, -O0):
<printHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     119f <printHeader+0x4f>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x130(%rbp),%rdi
mov    -0x128(%rbp),%rsi
mov    %eax,%edx
call   1070 <memcpy@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x100,-0x18(%rbp)
jae    1252 <printHeader+0x102>
mov    -0x18(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1206 <printHeader+0xb6>
jmp    1252 <printHeader+0x102>
mov    -0x18(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x2e,%eax
je     1230 <printHeader+0xe0>
mov    -0x18(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x2d,%eax
jne    123c <printHeader+0xec>
mov    -0x18(%rbp),%rax
movb   $0x5f,-0x120(%rbp,%rax,1)
5f
jmp    1241 <printHeader+0xf1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11de <printHeader+0x8e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xd98(%rip),%rsi
call   1060 <fprintf@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHeader>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r13
mov    %rdi,%r14
mov    %rsp,%r12
xor    %ebx,%ebx
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
mov    %r13,%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
lea    0x1(%rax),%r15
test   %rax,%rax
cmove  %r13,%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1070 <memcpy@plt>
jmp    11c2 <printHeader+0x72>
nopl   0x0(%rax)
movb   $0x5f,0x3(%rsp,%rbx,1)
add    $0x4,%rbx
cmp    $0x100,%rbx
je     123d <printHeader+0xed>
movzbl (%rsp,%rbx,1),%eax
lea    -0x2d(%rax),%ecx
cmp    $0x2,%cl
jae    11e0 <printHeader+0x90>
movb   $0x5f,(%rsp,%rbx,1)
jmp    11e4 <printHeader+0x94>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %al,%al
je     123d <printHeader+0xed>
movzbl 0x1(%rsp,%rbx,1),%eax
lea    -0x2d(%rax),%ecx
cmp    $0x2,%cl
jae    1200 <printHeader+0xb0>
movb   $0x5f,0x1(%rsp,%rbx,1)
jmp    1204 <printHeader+0xb4>
nopl   0x0(%rax,%rax,1)
test   %al,%al
je     123d <printHeader+0xed>
movzbl 0x2(%rsp,%rbx,1),%eax
lea    -0x2d(%rax),%ecx
cmp    $0x2,%cl
jae    1220 <printHeader+0xd0>
movb   $0x5f,0x2(%rsp,%rbx,1)
jmp    1224 <printHeader+0xd4>
nopl   0x0(%rax,%rax,1)
test   %al,%al
je     123d <printHeader+0xed>
movzbl 0x3(%rsp,%rbx,1),%eax
lea    -0x2d(%rax),%ecx
cmp    $0x2,%cl
jb     11b0 <printHeader+0x60>
test   %al,%al
jne    11b5 <printHeader+0x65>
lea    0xdbc(%rip),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    %r15,%rdx
call   1060 <fprintf@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [357 x i8] c"/*===============================================================*\0A This file is automatically generated by wopn2hpp.sh script\0A PLEASE DON'T EDIT THIS DIRECTLY. Edit the %s file first,\0A and then run a wopn2hpp tool to generate this file again\0A *===============================================================*/\0A\0Astatic unsigned char g_%s_bank[] = \0A{\0A\00"
define void @printHeader(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca [256 x i8]
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 256)
%10 = load i8*, i8** %4
%11 = call i8* @strrchr(i8* %10, i8 signext 47)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %4
br label %17
17: ; preds = %14, %2
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%19 = load i8*, i8** %4
%20 = load i8*, i8** %4
%21 = call i32 @strlen(i8* %20)
%22 = call i32 @memcpy(i8* %18, i8* %19, i32 %21)
store i64 0, i64* %5
br label %23
23: ; preds = %49, %17
%24 = load i64, i64* %5
%25 = icmp ult i64 %24, 256
br i1 %25, label %26, label %52
26: ; preds = %23
%27 = load i64, i64* %5
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %26
br label %52
33: ; preds = %26
%34 = load i64, i64* %5
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 46
br i1 %38, label %45, label %39
39: ; preds = %33
%40 = load i64, i64* %5
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 45
br i1 %44, label %45, label %48
45: ; preds = %39, %33
%46 = load i64, i64* %5
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %46
store i8 95, i8* %47
br label %48
48: ; preds = %45, %39
br label %49
49: ; preds = %48
%50 = load i64, i64* %5
%51 = add i64 %50, 1
store i64 %51, i64* %5
br label %23
52: ; preds = %32, %23
%53 = load i32*, i32** %3
%54 = load i8*, i8** %4
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%56 = call i32 @fprintf(i32* %53, i8* getelementptr inbounds ([357 x i8], [357 x i8]* @.str, i64 0, i64 0), i8* %54, i8* %55)
ret void
}

LLVM IR (-O2):
@.str = [357 x i8] c"/*===============================================================*\0A This file is automatically generated by wopn2hpp.sh script\0A PLEASE DON'T EDIT THIS DIRECTLY. Edit the %s file first,\0A and then run a wopn2hpp tool to generate this file again\0A *===============================================================*/\0A\0Astatic unsigned char g_%s_bank[] = \0A{\0A\00"
define void @printHeader(i32* nocapture %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 256)
%6 = call i8* @strrchr(i8* dereferenceable(1) %1, i8 signext 47)
%7 = icmp eq i8* %6, null
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = select i1 %7, i8* %1, i8* %8
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @memcpy(i8* %4, i8* %9, i32 %10)
br label %12
12: ; preds = %32, %2
%13 = phi i64 [ 0, %2 ], [ %33, %32 ]
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %13
%15 = load i8, i8* %14
switch i8 %15, label %17 [
i8 0, label %35
i8 46, label %16
i8 45, label %16
]
16: ; preds = %12, %12
store i8 95, i8* %14
br label %17
17: ; preds = %12, %16
%18 = or i64 %13, 1
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %18
%20 = load i8, i8* %19
switch i8 %20, label %22 [
i8 0, label %35
i8 46, label %21
i8 45, label %21
]
21: ; preds = %17, %17
store i8 95, i8* %19
br label %22
22: ; preds = %21, %17
%23 = or i64 %13, 2
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
switch i8 %25, label %27 [
i8 0, label %35
i8 46, label %26
i8 45, label %26
]
26: ; preds = %22, %22
store i8 95, i8* %24
br label %27
27: ; preds = %26, %22
%28 = or i64 %13, 3
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %28
%30 = load i8, i8* %29
switch i8 %30, label %32 [
i8 0, label %35
i8 46, label %31
i8 45, label %31
]
31: ; preds = %27, %27
store i8 95, i8* %29
br label %32
32: ; preds = %31, %27
%33 = add nuw nsw i64 %13, 4
%34 = icmp eq i64 %33, 256
br i1 %34, label %35, label %12
35: ; preds = %32, %27, %22, %17, %12
%36 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([357 x i8], [357 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %4)
ret void
}