#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*/ SEEK_CUR;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, ...);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ taka_tstring_one_tab_space(char *);
int taka_tvpp_create_package_template(const char *orig_file, FILE *cerr) {
  FILE *of, *cf;
  char *name, *line, *p, *q;
  of = fopen(orig_file, "rt");
  if (!of) {
    if (cerr)
      fprintf(cerr, "Can't open the original file: %s.\n", orig_file);
    return (-32);
  }
  cf = fopen("package.vhd", "wt");
  if (!cf) {
    fclose(of);
    if (cerr)
      fprintf(cerr, "Can't open a converted file: %s.\n", "package.vhd");
    return (-33);
  }
  name = (char *)malloc(sizeof(char) * 4096);
  line = (char *)malloc(sizeof(char) * 4096);
  fprintf(cf, "library ieee;\n");
  fprintf(cf, "use ieee.std_logic_1164.all;\n");
  fprintf(cf, "\n");
  fscanf(of, "%s %s\n", line, name);
  if (!strcmp(line, "entity") || !strcmp(line, "component"))
    fprintf(cf, "component %s\n", name);
  fscanf(of, "%s\n", line);
  if (!strcmp(line, "generic")) {
    fprintf(cf, "\tgeneric (\n");
    while (fgets(line, 4096, of) != NULL) {
      taka_tstring_one_tab_space(line);
      p = line;
      for (q = p; *q != ' ' && *q != '\n' && *q != '\0'; q++)
        ;
      if (*q == '\0')
        continue;
      *q = '\0';
      if (!strcmp(p, "port"))
        break;
      fprintf(cf, "\t\t%s:\t\t\t", p);
      p = q + 1;
      for (q = p; *q != ' ' && *q != '\n' && *q != '\0'; q++)
        ;
      if (*q == '\0')
        continue;
      *q = '\0';
      fprintf(cf, "%s := ", p);
      p = q + 1;
      for (q = p; *q != '\n' && *q != '\0'; q++)
        ;
      if (*q == '\0')
        continue;
      *q = '\0';
      fprintf(cf, "%s;\n", p);
    }
    fseek(cf, -2, SEEK_CUR);
    fprintf(cf, "\n\t);\n");
  }
  if (!strcmp(line, "port")) {
    fprintf(cf, "\tport (\n");
    while (fgets(line, 4096, of) != NULL) {
      taka_tstring_one_tab_space(line);
      p = line;
      for (q = p; *q != ' ' && *q != '\n' && *q != '\0'; q++)
        ;
      if (*q == '\0')
        continue;
      *q = '\0';
      fprintf(cf, "\t\t%s:\t\t\t", p);
      p = q + 1;
      for (q = p; *q != ' ' && *q != '\n' && *q != '\0'; q++)
        ;
      if (*q == '\0')
        continue;
      *q = '\0';
      fprintf(cf, "%s ", p);
      p = q + 1;
      for (q = p; *q != '\n' && *q != '\0'; q++)
        ;
      if (*q == '\0')
        continue;
      *q = '\0';
      fprintf(cf, "%s;\n", p);
    }
    fseek(cf, -2, SEEK_CUR);
    fprintf(cf, "\n\t);\n");
  }
  fprintf(cf, "end component;\n");
  free(line);
  free(name);
  fclose(cf);
  fclose(of);
  return (0);
}


x86 assembly (clang, -O0):
<taka_tvpp_create_package_template>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xf02(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11fc <taka_tvpp_create_package_template+0x5c>
cmpq   $0x0,-0x18(%rbp)
je     11f0 <taka_tvpp_create_package_template+0x50>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffe0,-0x4(%rbp)
jmp    182a <taka_tvpp_create_package_template+0x68a>
lea    0xe20(%rip),%rdi
lea    0xe25(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1257 <taka_tvpp_create_package_template+0xb7>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0x18(%rbp)
je     124b <taka_tvpp_create_package_template+0xab>
mov    -0x18(%rbp),%rdi
lea    0xdf5(%rip),%rsi
lea    0xddf(%rip),%rdx
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffdf,-0x4(%rbp)
jmp    182a <taka_tvpp_create_package_template+0x68a>
mov    $0x1000,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x1000,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xdc5(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x38(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     12f5 <taka_tvpp_create_package_template+0x155>
mov    -0x38(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    130b <taka_tvpp_create_package_template+0x16b>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xd95(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xd6a(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x38(%rbp),%rdi
lea    0xd7b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1596 <taka_tvpp_create_package_template+0x3f6>
mov    -0x28(%rbp),%rdi
lea    0xd6a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x1000,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     156d <taka_tvpp_create_package_template+0x3cd>
mov    -0x38(%rbp),%rdi
call   1050 <taka_tstring_one_tab_space@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x49(%rbp)
je     13bb <taka_tvpp_create_package_template+0x21b>
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x49(%rbp)
je     13bb <taka_tvpp_create_package_template+0x21b>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    13cb <taka_tvpp_create_package_template+0x22b>
jmp    13e1 <taka_tvpp_create_package_template+0x241>
jmp    13d0 <taka_tvpp_create_package_template+0x230>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1381 <taka_tvpp_create_package_template+0x1e1>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    13f6 <taka_tvpp_create_package_template+0x256>
jmp    134c <taka_tvpp_create_package_template+0x1ac>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x40(%rbp),%rdi
lea    0xcb3(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    141b <taka_tvpp_create_package_template+0x27b>
jmp    156d <taka_tvpp_create_package_template+0x3cd>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x4a(%rbp)
je     147f <taka_tvpp_create_package_template+0x2df>
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x4a(%rbp)
je     147f <taka_tvpp_create_package_template+0x2df>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x4a(%rbp)
mov    -0x4a(%rbp),%al
test   $0x1,%al
jne    148f <taka_tvpp_create_package_template+0x2ef>
jmp    14a5 <taka_tvpp_create_package_template+0x305>
jmp    1494 <taka_tvpp_create_package_template+0x2f4>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1445 <taka_tvpp_create_package_template+0x2a5>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    14ba <taka_tvpp_create_package_template+0x31a>
jmp    134c <taka_tvpp_create_package_template+0x1ac>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xbf9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x4b(%rbp)
je     1510 <taka_tvpp_create_package_template+0x370>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x4b(%rbp)
mov    -0x4b(%rbp),%al
test   $0x1,%al
jne    1520 <taka_tvpp_create_package_template+0x380>
jmp    1536 <taka_tvpp_create_package_template+0x396>
jmp    1525 <taka_tvpp_create_package_template+0x385>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    14eb <taka_tvpp_create_package_template+0x34b>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    154b <taka_tvpp_create_package_template+0x3ab>
jmp    134c <taka_tvpp_create_package_template+0x1ac>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xb6f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    134c <taka_tvpp_create_package_template+0x1ac>
mov    -0x28(%rbp),%rdi
mov    0x2a70(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffe,%esi
call   10b0 <fseek@plt>
mov    -0x28(%rbp),%rdi
lea    0xb46(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xb1a(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    17ed <taka_tvpp_create_package_template+0x64d>
mov    -0x28(%rbp),%rdi
lea    0xb21(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x1000,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     17c4 <taka_tvpp_create_package_template+0x624>
mov    -0x38(%rbp),%rdi
call   1050 <taka_tstring_one_tab_space@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x4c(%rbp)
je     1630 <taka_tvpp_create_package_template+0x490>
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x4c(%rbp)
je     1630 <taka_tvpp_create_package_template+0x490>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x4c(%rbp)
mov    -0x4c(%rbp),%al
test   $0x1,%al
jne    1640 <taka_tvpp_create_package_template+0x4a0>
jmp    1656 <taka_tvpp_create_package_template+0x4b6>
jmp    1645 <taka_tvpp_create_package_template+0x4a5>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    15f6 <taka_tvpp_create_package_template+0x456>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    166b <taka_tvpp_create_package_template+0x4cb>
jmp    15c1 <taka_tvpp_create_package_template+0x421>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xa3f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x4d(%rbp)
je     16d6 <taka_tvpp_create_package_template+0x536>
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x4d(%rbp)
je     16d6 <taka_tvpp_create_package_template+0x536>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
test   $0x1,%al
jne    16e6 <taka_tvpp_create_package_template+0x546>
jmp    16fc <taka_tvpp_create_package_template+0x55c>
jmp    16eb <taka_tvpp_create_package_template+0x54b>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    169c <taka_tvpp_create_package_template+0x4fc>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1711 <taka_tvpp_create_package_template+0x571>
jmp    15c1 <taka_tvpp_create_package_template+0x421>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0x9bd(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x4e(%rbp)
je     1767 <taka_tvpp_create_package_template+0x5c7>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x4e(%rbp)
mov    -0x4e(%rbp),%al
test   $0x1,%al
jne    1777 <taka_tvpp_create_package_template+0x5d7>
jmp    178d <taka_tvpp_create_package_template+0x5ed>
jmp    177c <taka_tvpp_create_package_template+0x5dc>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1742 <taka_tvpp_create_package_template+0x5a2>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    17a2 <taka_tvpp_create_package_template+0x602>
jmp    15c1 <taka_tvpp_create_package_template+0x421>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0x918(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    15c1 <taka_tvpp_create_package_template+0x421>
mov    -0x28(%rbp),%rdi
mov    0x2819(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffe,%esi
call   10b0 <fseek@plt>
mov    -0x28(%rbp),%rdi
lea    0x8ef(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x8f0(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<taka_tvpp_create_package_template>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xee2(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     141a <taka_tvpp_create_package_template+0x25a>
mov    %rax,%r14
lea    0xe30(%rip),%rdi
lea    0xe35(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1437 <taka_tvpp_create_package_template+0x277>
mov    %rax,%r12
mov    $0x1000,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    $0x1000,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
lea    0xe28(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
lea    0xe1e(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
lea    0xe16(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xe06(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
je     12a1 <taka_tvpp_create_package_template+0xe1>
lea    0xdfa(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    12b5 <taka_tvpp_create_package_template+0xf5>
lea    0xdf1(%rip),%rsi
mov    %r12,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xdc8(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xdd7(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    149e <taka_tvpp_create_package_template+0x2de>
mov    %rbp,0x10(%rsp)
lea    0xdc3(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     146a <taka_tvpp_create_package_template+0x2aa>
lea    0x1(%rbx),%rax
mov    %rax,0x8(%rsp)
lea    0x2(%rbx),%r13
jmp    1360 <taka_tvpp_create_package_template+0x1a0>
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%rax)
mov    %r12,%rdi
lea    0xd93(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     146a <taka_tvpp_create_package_template+0x2aa>
mov    %rbx,%rdi
call   1050 <taka_tstring_one_tab_space@plt>
mov    %r13,%r15
mov    0x8(%rsp),%rbp
movzbl -0x1(%rbp),%eax
test   %al,%al
je     1347 <taka_tvpp_create_package_template+0x187>
cmp    $0xa,%al
je     1390 <taka_tvpp_create_package_template+0x1d0>
cmp    $0x20,%al
je     1390 <taka_tvpp_create_package_template+0x1d0>
add    $0x1,%rbp
add    $0x1,%r15
jmp    1370 <taka_tvpp_create_package_template+0x1b0>
nopw   0x0(%rax,%rax,1)
movb   $0x0,-0x1(%rbp)
mov    %rbx,%rdi
lea    0xd1d(%rip),%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     146a <taka_tvpp_create_package_template+0x2aa>
mov    %r12,%rdi
lea    0xd0b(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
nop
movzbl -0x1(%r15),%eax
test   %al,%al
je     1347 <taka_tvpp_create_package_template+0x187>
cmp    $0xa,%al
je     13e0 <taka_tvpp_create_package_template+0x220>
cmp    $0x20,%al
je     13e0 <taka_tvpp_create_package_template+0x220>
add    $0x1,%r15
jmp    13c0 <taka_tvpp_create_package_template+0x200>
nopl   0x0(%rax,%rax,1)
movb   $0x0,-0x1(%r15)
mov    %r12,%rdi
lea    0xcda(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r15,%rax
nopl   0x0(%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1347 <taka_tvpp_create_package_template+0x187>
cmp    $0xa,%cl
je     1330 <taka_tvpp_create_package_template+0x170>
add    $0x1,%rax
jmp    1400 <taka_tvpp_create_package_template+0x240>
mov    $0xffffffe0,%ebp
test   %r15,%r15
je     164e <taka_tvpp_create_package_template+0x48e>
lea    0xbd1(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
jmp    145e <taka_tvpp_create_package_template+0x29e>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    $0xffffffdf,%ebp
test   %r15,%r15
je     164e <taka_tvpp_create_package_template+0x48e>
lea    0xbde(%rip),%rsi
lea    0xbc8(%rip),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    164e <taka_tvpp_create_package_template+0x48e>
mov    0x2b77(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    $0xfffffffe,%esi
call   10c0 <fseek@plt>
lea    0xc4e(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
mov    0x10(%rsp),%rbp
lea    0xc16(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    1613 <taka_tvpp_create_package_template+0x453>
mov    %rbp,0x10(%rsp)
lea    0xc1a(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r14,0x8(%rsp)
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     15da <taka_tvpp_create_package_template+0x41a>
lea    0x1(%rbx),%rbp
mov    %rbx,%r14
add    $0x2,%r14
jmp    1532 <taka_tvpp_create_package_template+0x372>
xchg   %ax,%ax
movb   $0x0,(%rax)
mov    %r12,%rdi
lea    0xbc3(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    0x8(%rsp),%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     15da <taka_tvpp_create_package_template+0x41a>
mov    %rbx,%rdi
call   1050 <taka_tstring_one_tab_space@plt>
mov    %r14,%r13
mov    %rbp,%r15
movzbl -0x1(%r15),%eax
test   %al,%al
je     1517 <taka_tvpp_create_package_template+0x357>
cmp    $0xa,%al
je     1560 <taka_tvpp_create_package_template+0x3a0>
cmp    $0x20,%al
je     1560 <taka_tvpp_create_package_template+0x3a0>
add    $0x1,%r15
add    $0x1,%r13
jmp    1540 <taka_tvpp_create_package_template+0x380>
nopl   0x0(%rax,%rax,1)
movb   $0x0,-0x1(%r15)
mov    %r12,%rdi
lea    0xb51(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
nopl   0x0(%rax)
movzbl -0x1(%r13),%eax
test   %al,%al
je     1517 <taka_tvpp_create_package_template+0x357>
cmp    $0xa,%al
je     15a0 <taka_tvpp_create_package_template+0x3e0>
cmp    $0x20,%al
je     15a0 <taka_tvpp_create_package_template+0x3e0>
add    $0x1,%r13
jmp    1580 <taka_tvpp_create_package_template+0x3c0>
nopw   0x0(%rax,%rax,1)
movb   $0x0,-0x1(%r13)
mov    %r12,%rdi
lea    0xb35(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r13,%rax
nopl   0x0(%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1517 <taka_tvpp_create_package_template+0x357>
cmp    $0xa,%cl
je     1500 <taka_tvpp_create_package_template+0x340>
add    $0x1,%rax
jmp    15c0 <taka_tvpp_create_package_template+0x400>
mov    0x2a07(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    $0xfffffffe,%esi
call   10c0 <fseek@plt>
lea    0xade(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
mov    0x8(%rsp),%r14
mov    0x10(%rsp),%rbp
lea    0xace(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [35 x i8] c"Can't open the original file: %s.\0A\00"
@.str.2 = [12 x i8] c"package.vhd\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [34 x i8] c"Can't open a converted file: %s.\0A\00"
@.str.5 = [15 x i8] c"library ieee;\0A\00"
@.str.6 = [30 x i8] c"use ieee.std_logic_1164.all;\0A\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [7 x i8] c"%s %s\0A\00"
@.str.9 = [7 x i8] c"entity\00"
@.str.10 = [10 x i8] c"component\00"
@.str.11 = [14 x i8] c"component %s\0A\00"
@.str.12 = [4 x i8] c"%s\0A\00"
@.str.13 = [8 x i8] c"generic\00"
@.str.14 = [12 x i8] c"\09generic (\0A\00"
@.str.15 = [5 x i8] c"port\00"
@.str.16 = [9 x i8] c"\09\09%s:\09\09\09\00"
@.str.17 = [7 x i8] c"%s := \00"
@.str.18 = [5 x i8] c"%s;\0A\00"
@SEEK_CUR = global i32 0
@.str.19 = [6 x i8] c"\0A\09);\0A\00"
@.str.20 = [9 x i8] c"\09port (\0A\00"
@.str.21 = [4 x i8] c"%s \00"
@.str.22 = [16 x i8] c"end component;\0A\00"
define i32 @taka_tvpp_create_package_template(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
%12 = load i8*, i8** %4
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %6
%14 = load i32*, i32** %6
%15 = icmp ne i32* %14, null
br i1 %15, label %24, label %16
16: ; preds = %2
%17 = load i32*, i32** %5
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32*, i32** %5
%21 = load i8*, i8** %4
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19, %16
store i32 -32, i32* %3
br label %322
24: ; preds = %2
%25 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %25, i32** %7
%26 = load i32*, i32** %7
%27 = icmp ne i32* %26, null
br i1 %27, label %37, label %28
28: ; preds = %24
%29 = load i32*, i32** %6
%30 = call i32 @fclose(i32* %29)
%31 = load i32*, i32** %5
%32 = icmp ne i32* %31, null
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i32*, i32** %5
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %33, %28
store i32 -33, i32* %3
br label %322
37: ; preds = %24
%38 = call i64 @malloc(i32 4096)
%39 = inttoptr i64 %38 to i8*
store i8* %39, i8** %8
%40 = call i64 @malloc(i32 4096)
%41 = inttoptr i64 %40 to i8*
store i8* %41, i8** %9
%42 = load i32*, i32** %7
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%44 = load i32*, i32** %7
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%46 = load i32*, i32** %7
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%48 = load i32*, i32** %6
%49 = load i8*, i8** %9
%50 = load i8*, i8** %8
%51 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %49, i8* %50)
%52 = load i8*, i8** %9
%53 = call i32 @strcmp(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %37
%56 = load i8*, i8** %9
%57 = call i32 @strcmp(i8* %56, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%58 = icmp ne i32 %57, 0
br i1 %58, label %63, label %59
59: ; preds = %55, %37
%60 = load i32*, i32** %7
%61 = load i8*, i8** %8
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %61)
br label %63
63: ; preds = %59, %55
%64 = load i32*, i32** %6
%65 = load i8*, i8** %9
%66 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %65)
%67 = load i8*, i8** %9
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %191, label %70
70: ; preds = %63
%71 = load i32*, i32** %7
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
br label %73
73: ; preds = %180, %179, %149, %109, %70
%74 = load i8*, i8** %9
%75 = load i32*, i32** %6
%76 = call i32* @fgets(i8* %74, i32 4096, i32* %75)
%77 = icmp ne i32* %76, null
br i1 %77, label %78, label %185
78: ; preds = %73
%79 = load i8*, i8** %9
%80 = call i32 @taka_tstring_one_tab_space(i8* %79)
%81 = load i8*, i8** %9
store i8* %81, i8** %10
%82 = load i8*, i8** %10
store i8* %82, i8** %11
br label %83
83: ; preds = %101, %78
%84 = load i8*, i8** %11
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp ne i32 %86, 32
br i1 %87, label %88, label %98
88: ; preds = %83
%89 = load i8*, i8** %11
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp ne i32 %91, 10
br i1 %92, label %93, label %98
93: ; preds = %88
%94 = load i8*, i8** %11
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp ne i32 %96, 0
br label %98
98: ; preds = %93, %88, %83
%99 = phi i1 [ false, %88 ], [ false, %83 ], [ %97, %93 ]
br i1 %99, label %100, label %104
100: ; preds = %98
br label %101
101: ; preds = %100
%102 = load i8*, i8** %11
%103 = getelementptr inbounds i8, i8* %102, i32 1
store i8* %103, i8** %11
br label %83
104: ; preds = %98
%105 = load i8*, i8** %11
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 0
br i1 %108, label %109, label %110
109: ; preds = %104
br label %73
110: ; preds = %104
%111 = load i8*, i8** %11
store i8 0, i8* %111
%112 = load i8*, i8** %10
%113 = call i32 @strcmp(i8* %112, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%114 = icmp ne i32 %113, 0
br i1 %114, label %116, label %115
115: ; preds = %110
br label %185
116: ; preds = %110
%117 = load i32*, i32** %7
%118 = load i8*, i8** %10
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %118)
%120 = load i8*, i8** %11
%121 = getelementptr inbounds i8, i8* %120, i64 1
store i8* %121, i8** %10
%122 = load i8*, i8** %10
store i8* %122, i8** %11
br label %123
123: ; preds = %141, %116
%124 = load i8*, i8** %11
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp ne i32 %126, 32
br i1 %127, label %128, label %138
128: ; preds = %123
%129 = load i8*, i8** %11
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = icmp ne i32 %131, 10
br i1 %132, label %133, label %138
133: ; preds = %128
%134 = load i8*, i8** %11
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp ne i32 %136, 0
br label %138
138: ; preds = %133, %128, %123
%139 = phi i1 [ false, %128 ], [ false, %123 ], [ %137, %133 ]
br i1 %139, label %140, label %144
140: ; preds = %138
br label %141
141: ; preds = %140
%142 = load i8*, i8** %11
%143 = getelementptr inbounds i8, i8* %142, i32 1
store i8* %143, i8** %11
br label %123
144: ; preds = %138
%145 = load i8*, i8** %11
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %150
149: ; preds = %144
br label %73
150: ; preds = %144
%151 = load i8*, i8** %11
store i8 0, i8* %151
%152 = load i32*, i32** %7
%153 = load i8*, i8** %10
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %153)
%155 = load i8*, i8** %11
%156 = getelementptr inbounds i8, i8* %155, i64 1
store i8* %156, i8** %10
%157 = load i8*, i8** %10
store i8* %157, i8** %11
br label %158
158: ; preds = %171, %150
%159 = load i8*, i8** %11
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp ne i32 %161, 10
br i1 %162, label %163, label %168
163: ; preds = %158
%164 = load i8*, i8** %11
%165 = load i8, i8* %164
%166 = sext i8 %165 to i32
%167 = icmp ne i32 %166, 0
br label %168
168: ; preds = %163, %158
%169 = phi i1 [ false, %158 ], [ %167, %163 ]
br i1 %169, label %170, label %174
170: ; preds = %168
br label %171
171: ; preds = %170
%172 = load i8*, i8** %11
%173 = getelementptr inbounds i8, i8* %172, i32 1
store i8* %173, i8** %11
br label %158
174: ; preds = %168
%175 = load i8*, i8** %11
%176 = load i8, i8* %175
%177 = sext i8 %176 to i32
%178 = icmp eq i32 %177, 0
br i1 %178, label %179, label %180
179: ; preds = %174
br label %73
180: ; preds = %174
%181 = load i8*, i8** %11
store i8 0, i8* %181
%182 = load i32*, i32** %7
%183 = load i8*, i8** %10
%184 = call i32 (i32*, i8*, ...) @fprintf(i32* %182, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %183)
br label %73
185: ; preds = %115, %73
%186 = load i32*, i32** %7
%187 = load i32, i32* @SEEK_CUR
%188 = call i32 @fseek(i32* %186, i32 -2, i32 %187)
%189 = load i32*, i32** %7
%190 = call i32 (i32*, i8*, ...) @fprintf(i32* %189, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
br label %191
191: ; preds = %185, %63
%192 = load i8*, i8** %9
%193 = call i32 @strcmp(i8* %192, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%194 = icmp ne i32 %193, 0
br i1 %194, label %311, label %195
195: ; preds = %191
%196 = load i32*, i32** %7
%197 = call i32 (i32*, i8*, ...) @fprintf(i32* %196, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0))
br label %198
198: ; preds = %300, %299, %269, %234, %195
%199 = load i8*, i8** %9
%200 = load i32*, i32** %6
%201 = call i32* @fgets(i8* %199, i32 4096, i32* %200)
%202 = icmp ne i32* %201, null
br i1 %202, label %203, label %305
203: ; preds = %198
%204 = load i8*, i8** %9
%205 = call i32 @taka_tstring_one_tab_space(i8* %204)
%206 = load i8*, i8** %9
store i8* %206, i8** %10
%207 = load i8*, i8** %10
store i8* %207, i8** %11
br label %208
208: ; preds = %226, %203
%209 = load i8*, i8** %11
%210 = load i8, i8* %209
%211 = sext i8 %210 to i32
%212 = icmp ne i32 %211, 32
br i1 %212, label %213, label %223
213: ; preds = %208
%214 = load i8*, i8** %11
%215 = load i8, i8* %214
%216 = sext i8 %215 to i32
%217 = icmp ne i32 %216, 10
br i1 %217, label %218, label %223
218: ; preds = %213
%219 = load i8*, i8** %11
%220 = load i8, i8* %219
%221 = sext i8 %220 to i32
%222 = icmp ne i32 %221, 0
br label %223
223: ; preds = %218, %213, %208
%224 = phi i1 [ false, %213 ], [ false, %208 ], [ %222, %218 ]
br i1 %224, label %225, label %229
225: ; preds = %223
br label %226
226: ; preds = %225
%227 = load i8*, i8** %11
%228 = getelementptr inbounds i8, i8* %227, i32 1
store i8* %228, i8** %11
br label %208
229: ; preds = %223
%230 = load i8*, i8** %11
%231 = load i8, i8* %230
%232 = sext i8 %231 to i32
%233 = icmp eq i32 %232, 0
br i1 %233, label %234, label %235
234: ; preds = %229
br label %198
235: ; preds = %229
%236 = load i8*, i8** %11
store i8 0, i8* %236
%237 = load i32*, i32** %7
%238 = load i8*, i8** %10
%239 = call i32 (i32*, i8*, ...) @fprintf(i32* %237, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %238)
%240 = load i8*, i8** %11
%241 = getelementptr inbounds i8, i8* %240, i64 1
store i8* %241, i8** %10
%242 = load i8*, i8** %10
store i8* %242, i8** %11
br label %243
243: ; preds = %261, %235
%244 = load i8*, i8** %11
%245 = load i8, i8* %244
%246 = sext i8 %245 to i32
%247 = icmp ne i32 %246, 32
br i1 %247, label %248, label %258
248: ; preds = %243
%249 = load i8*, i8** %11
%250 = load i8, i8* %249
%251 = sext i8 %250 to i32
%252 = icmp ne i32 %251, 10
br i1 %252, label %253, label %258
253: ; preds = %248
%254 = load i8*, i8** %11
%255 = load i8, i8* %254
%256 = sext i8 %255 to i32
%257 = icmp ne i32 %256, 0
br label %258
258: ; preds = %253, %248, %243
%259 = phi i1 [ false, %248 ], [ false, %243 ], [ %257, %253 ]
br i1 %259, label %260, label %264
260: ; preds = %258
br label %261
261: ; preds = %260
%262 = load i8*, i8** %11
%263 = getelementptr inbounds i8, i8* %262, i32 1
store i8* %263, i8** %11
br label %243
264: ; preds = %258
%265 = load i8*, i8** %11
%266 = load i8, i8* %265
%267 = sext i8 %266 to i32
%268 = icmp eq i32 %267, 0
br i1 %268, label %269, label %270
269: ; preds = %264
br label %198
270: ; preds = %264
%271 = load i8*, i8** %11
store i8 0, i8* %271
%272 = load i32*, i32** %7
%273 = load i8*, i8** %10
%274 = call i32 (i32*, i8*, ...) @fprintf(i32* %272, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i8* %273)
%275 = load i8*, i8** %11
%276 = getelementptr inbounds i8, i8* %275, i64 1
store i8* %276, i8** %10
%277 = load i8*, i8** %10
store i8* %277, i8** %11
br label %278
278: ; preds = %291, %270
%279 = load i8*, i8** %11
%280 = load i8, i8* %279
%281 = sext i8 %280 to i32
%282 = icmp ne i32 %281, 10
br i1 %282, label %283, label %288
283: ; preds = %278
%284 = load i8*, i8** %11
%285 = load i8, i8* %284
%286 = sext i8 %285 to i32
%287 = icmp ne i32 %286, 0
br label %288
288: ; preds = %283, %278
%289 = phi i1 [ false, %278 ], [ %287, %283 ]
br i1 %289, label %290, label %294
290: ; preds = %288
br label %291
291: ; preds = %290
%292 = load i8*, i8** %11
%293 = getelementptr inbounds i8, i8* %292, i32 1
store i8* %293, i8** %11
br label %278
294: ; preds = %288
%295 = load i8*, i8** %11
%296 = load i8, i8* %295
%297 = sext i8 %296 to i32
%298 = icmp eq i32 %297, 0
br i1 %298, label %299, label %300
299: ; preds = %294
br label %198
300: ; preds = %294
%301 = load i8*, i8** %11
store i8 0, i8* %301
%302 = load i32*, i32** %7
%303 = load i8*, i8** %10
%304 = call i32 (i32*, i8*, ...) @fprintf(i32* %302, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %303)
br label %198
305: ; preds = %198
%306 = load i32*, i32** %7
%307 = load i32, i32* @SEEK_CUR
%308 = call i32 @fseek(i32* %306, i32 -2, i32 %307)
%309 = load i32*, i32** %7
%310 = call i32 (i32*, i8*, ...) @fprintf(i32* %309, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
br label %311
311: ; preds = %305, %191
%312 = load i32*, i32** %7
%313 = call i32 (i32*, i8*, ...) @fprintf(i32* %312, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0))
%314 = load i8*, i8** %9
%315 = call i32 @free(i8* %314)
%316 = load i8*, i8** %8
%317 = call i32 @free(i8* %316)
%318 = load i32*, i32** %7
%319 = call i32 @fclose(i32* %318)
%320 = load i32*, i32** %6
%321 = call i32 @fclose(i32* %320)
store i32 0, i32* %3
br label %322
322: ; preds = %311, %36, %23
%323 = load i32, i32* %3
ret i32 %323
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [35 x i8] c"Can't open the original file: %s.\0A\00"
@.str.2 = [12 x i8] c"package.vhd\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [34 x i8] c"Can't open a converted file: %s.\0A\00"
@.str.5 = [15 x i8] c"library ieee;\0A\00"
@.str.6 = [30 x i8] c"use ieee.std_logic_1164.all;\0A\00"
@.str.8 = [7 x i8] c"%s %s\0A\00"
@.str.9 = [7 x i8] c"entity\00"
@.str.10 = [10 x i8] c"component\00"
@.str.11 = [14 x i8] c"component %s\0A\00"
@.str.12 = [4 x i8] c"%s\0A\00"
@.str.13 = [8 x i8] c"generic\00"
@.str.14 = [12 x i8] c"\09generic (\0A\00"
@.str.15 = [5 x i8] c"port\00"
@.str.16 = [9 x i8] c"\09\09%s:\09\09\09\00"
@.str.17 = [7 x i8] c"%s := \00"
@.str.18 = [5 x i8] c"%s;\0A\00"
@SEEK_CUR = global i32 0
@.str.19 = [6 x i8] c"\0A\09);\0A\00"
@.str.20 = [9 x i8] c"\09port (\0A\00"
@.str.21 = [4 x i8] c"%s \00"
@.str.22 = [16 x i8] c"end component;\0A\00"
define i32 @taka_tvpp_create_package_template(i8* %0, i32* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = icmp eq i32* %1, null
br i1 %6, label %121, label %7
7: ; preds = %5
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %121
9: ; preds = %2
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = tail call i32 @fclose(i32* %3)
%14 = icmp eq i32* %1, null
br i1 %14, label %121, label %15
15: ; preds = %12
%16 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %121
17: ; preds = %9
%18 = tail call i64 @malloc(i32 4096)
%19 = inttoptr i64 %18 to i8*
%20 = tail call i64 @malloc(i32 4096)
%21 = inttoptr i64 %20 to i8*
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i64 14, i64 1, i32* %10)
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i64 29, i64 1, i32* %10)
%24 = tail call i32 @fputc(i32 10, i32* %10)
%25 = tail call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %21, i8* %19)
%26 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %17
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28, %17
%32 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %19)
br label %33
33: ; preds = %31, %28
%34 = tail call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %21)
%35 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %76
37: ; preds = %33
%38 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i64 11, i64 1, i32* %10)
%39 = tail call i32* @fgets(i8* %21, i32 4096, i32* %3)
%40 = icmp eq i32* %39, null
br i1 %40, label %72, label %41
41: ; preds = %37, %69
%42 = tail call i32 @taka_tstring_one_tab_space(i8* %21)
br label %43
43: ; preds = %46, %41
%44 = phi i8* [ %21, %41 ], [ %47, %46 ]
%45 = load i8, i8* %44
switch i8 %45, label %46 [
i8 0, label %69
i8 10, label %48
i8 32, label %48
]
46: ; preds = %43
%47 = getelementptr inbounds i8, i8* %44, i64 1
br label %43
48: ; preds = %43, %43
store i8 0, i8* %44
%49 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%50 = icmp eq i32 %49, 0
br i1 %50, label %72, label %51
51: ; preds = %48
%52 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %21)
%53 = getelementptr inbounds i8, i8* %44, i64 1
br label %54
54: ; preds = %57, %51
%55 = phi i8* [ %53, %51 ], [ %58, %57 ]
%56 = load i8, i8* %55
switch i8 %56, label %57 [
i8 0, label %69
i8 10, label %59
i8 32, label %59
]
57: ; preds = %54
%58 = getelementptr inbounds i8, i8* %55, i64 1
br label %54
59: ; preds = %54, %54
store i8 0, i8* %55
%60 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %53)
%61 = getelementptr inbounds i8, i8* %55, i64 1
br label %62
62: ; preds = %65, %59
%63 = phi i8* [ %61, %59 ], [ %66, %65 ]
%64 = load i8, i8* %63
switch i8 %64, label %65 [
i8 0, label %69
i8 10, label %67
]
65: ; preds = %62
%66 = getelementptr inbounds i8, i8* %63, i64 1
br label %62
67: ; preds = %62
store i8 0, i8* %63
%68 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %61)
br label %69
69: ; preds = %43, %54, %62, %67
%70 = tail call i32* @fgets(i8* %21, i32 4096, i32* %3)
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %41
72: ; preds = %69, %48, %37
%73 = load i32, i32* @SEEK_CUR
%74 = tail call i32 @fseek(i32* %10, i32 -2, i32 %73)
%75 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i64 5, i64 1, i32* %10)
br label %76
76: ; preds = %72, %33
%77 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %115
79: ; preds = %76
%80 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i64 8, i64 1, i32* %10)
%81 = tail call i32* @fgets(i8* %21, i32 4096, i32* %3)
%82 = icmp eq i32* %81, null
br i1 %82, label %111, label %83
83: ; preds = %79, %108
%84 = tail call i32 @taka_tstring_one_tab_space(i8* %21)
br label %85
85: ; preds = %88, %83
%86 = phi i8* [ %21, %83 ], [ %89, %88 ]
%87 = load i8, i8* %86
switch i8 %87, label %88 [
i8 0, label %108
i8 10, label %90
i8 32, label %90
]
88: ; preds = %85
%89 = getelementptr inbounds i8, i8* %86, i64 1
br label %85
90: ; preds = %85, %85
store i8 0, i8* %86
%91 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %21)
%92 = getelementptr inbounds i8, i8* %86, i64 1
br label %93
93: ; preds = %96, %90
%94 = phi i8* [ %92, %90 ], [ %97, %96 ]
%95 = load i8, i8* %94
switch i8 %95, label %96 [
i8 0, label %108
i8 10, label %98
i8 32, label %98
]
96: ; preds = %93
%97 = getelementptr inbounds i8, i8* %94, i64 1
br label %93
98: ; preds = %93, %93
store i8 0, i8* %94
%99 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i8* %92)
%100 = getelementptr inbounds i8, i8* %94, i64 1
br label %101
101: ; preds = %104, %98
%102 = phi i8* [ %100, %98 ], [ %105, %104 ]
%103 = load i8, i8* %102
switch i8 %103, label %104 [
i8 0, label %108
i8 10, label %106
]
104: ; preds = %101
%105 = getelementptr inbounds i8, i8* %102, i64 1
br label %101
106: ; preds = %101
store i8 0, i8* %102
%107 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %100)
br label %108
108: ; preds = %85, %93, %101, %106
%109 = tail call i32* @fgets(i8* %21, i32 4096, i32* %3)
%110 = icmp eq i32* %109, null
br i1 %110, label %111, label %83
111: ; preds = %108, %79
%112 = load i32, i32* @SEEK_CUR
%113 = tail call i32 @fseek(i32* %10, i32 -2, i32 %112)
%114 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i64 5, i64 1, i32* %10)
br label %115
115: ; preds = %111, %76
%116 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i64 15, i64 1, i32* %10)
%117 = tail call i32 @free(i8* %21)
%118 = tail call i32 @free(i8* %19)
%119 = tail call i32 @fclose(i32* %10)
%120 = tail call i32 @fclose(i32* %3)
br label %121
121: ; preds = %12, %15, %5, %7, %115
%122 = phi i32 [ 0, %115 ], [ -32, %7 ], [ -32, %5 ], [ -33, %15 ], [ -33, %12 ]
ret i32 %122
}