#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*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
size_t strlen(char *);
char *strpbrk(char *, char *);
int main(int argc, char *argv[]) {
  FILE *in, *out;
  int i;
  char *str;
  char *strp;
  char *charp;
  int fline;
  int line = 0;
  int lindex = 0;
  int tasm_count = -1;
  size_t len;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <file> [<file> ...]\n", argv[0]);
    return EXIT_FAILURE;
  }
  out = fopen("nasm-macros.c", "wt");
  if (!out) {
    fprintf(stderr, "Could not open `%s'.\n", "nasm-macros.c");
    return EXIT_FAILURE;
  }
  str = malloc(1024);
  fprintf(out, "/* This file auto-generated from standard.mac by genmacro.c"
               " - don't edit it */\n\n#include <stddef.h>\n\n"
               "static const char *stdmac[] = {\n");
  for (i = 1; i < argc; i++) {
    in = fopen(argv[i], "rt");
    if (!in) {
      fprintf(stderr, "Could not open `%s'.\n", argv[i]);
      fclose(out);
      remove("nasm-macros.c");
      return EXIT_FAILURE;
    }
    fline = 0;
    while (fgets(str, 1024, in)) {
      line++;
      fline++;
      strp = str;
      charp = strp;
      while ((charp = strpbrk(charp, "'\";"))) {
        if (charp[0] == ';') {
          *charp = '\0';
          break;
        }
        if ((charp = strchr(charp + 1, charp[0])) == NULL) {
          fprintf(stderr, "%s:%d: error: unterminated quote\n", argv[i], fline);
          fclose(out);
          remove("nasm-macros.c");
          return EXIT_FAILURE;
        }
        charp++;
      }
      while (*strp == ' ' || *strp == '\t')
        strp++;
      len = strlen(strp);
      while (len > 0 && (strp[len - 1] == ' ' || strp[len - 1] == '\t' ||
                         strp[len - 1] == '\n')) {
        strp[len - 1] = '\0';
        len--;
      }
      if (len == 0)
        continue;
      if (strcmp(strp, "*END*TASM*MACROS*") == 0) {
        tasm_count = lindex;
        continue;
      }
      fprintf(out, "    \"");
      while (*strp != '\0') {
        if (*strp == '\\' || *strp == '"')
          fputc('\\', out);
        fputc(*strp, out);
        strp++;
      }
      fprintf(out, "\",\n");
      lindex++;
    }
    fclose(in);
  }
  fprintf(out, "    NULL\n};\n");
  if (tasm_count == -1)
    tasm_count = lindex;
  fprintf(out, "#define TASM_MACRO_COUNT %d\n", tasm_count);
  fclose(out);
  free(str);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0xffffffff,-0x50(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1225 <main+0x65>
mov    0x2de4(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1642 <main+0x482>
lea    0xdf3(%rip),%rdi
lea    0xdfa(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1277 <main+0xb7>
mov    0x2d92(%rip),%rax
movslq (%rax),%rdi
lea    0xdd8(%rip),%rsi
lea    0xdc0(%rip),%rdx
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1642 <main+0x482>
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    15ed <main+0x42d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0f(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    131b <main+0x15b>
mov    0x2d08(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xd1a(%rip),%rdi
call   1040 <remove@plt>
mov    0x2cc7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1642 <main+0x482>
movl   $0x0,-0x44(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     15d6 <main+0x416>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   10d0 <strpbrk@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     141a <main+0x25a>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    139a <main+0x1da>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
jmp    141a <main+0x25a>
mov    -0x40(%rbp),%rdi
add    $0x1,%rdi
mov    -0x40(%rbp),%rax
movsbl (%rax),%esi
call   1070 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1409 <main+0x249>
mov    0x2c1d(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x44(%rbp),%ecx
lea    0xcf7(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xc2c(%rip),%rdi
call   1040 <remove@plt>
mov    0x2bd9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1642 <main+0x482>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1360 <main+0x1a0>
jmp    141f <main+0x25f>
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x59(%rbp)
je     1444 <main+0x284>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    1454 <main+0x294>
jmp    1465 <main+0x2a5>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    141f <main+0x25f>
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x58(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x58(%rbp)
mov    %al,-0x5a(%rbp)
jbe    14dd <main+0x31d>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x5b(%rbp)
je     14d7 <main+0x317>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x5b(%rbp)
je     14d7 <main+0x317>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x5b(%rbp)
mov    -0x5b(%rbp),%al
mov    %al,-0x5a(%rbp)
mov    -0x5a(%rbp),%al
test   $0x1,%al
jne    14ed <main+0x32d>
jmp    150e <main+0x34e>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x58(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x58(%rbp)
jmp    1472 <main+0x2b2>
cmpq   $0x0,-0x58(%rbp)
jne    151e <main+0x35e>
jmp    1322 <main+0x162>
mov    -0x38(%rbp),%rdi
lea    0xbcc(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1543 <main+0x383>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
jmp    1322 <main+0x162>
mov    -0x20(%rbp),%rdi
lea    0xbb9(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     15b6 <main+0x3f6>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1585 <main+0x3c5>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1593 <main+0x3d3>
mov    -0x20(%rbp),%rsi
mov    $0x5c,%edi
call   1080 <fputc@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1080 <fputc@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1555 <main+0x395>
mov    -0x20(%rbp),%rdi
lea    0xb4c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1322 <main+0x162>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    129e <main+0xde>
mov    -0x20(%rbp),%rdi
lea    0xb19(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
cmpl   $0xffffffff,-0x50(%rbp)
jne    160f <main+0x44f>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x50(%rbp),%edx
lea    0xb01(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    0x2993(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r12
cmp    $0x1,%edi
jg     1200 <main+0x30>
mov    0x2df3(%rip),%rax
movslq (%rax),%rdi
mov    (%r12),%rdx
lea    0xe05(%rip),%rsi
jmp    14f2 <main+0x322>
mov    %edi,%ebx
lea    0xe16(%rip),%rdi
lea    0xe1d(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     14da <main+0x30a>
mov    %rax,%rbp
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,%r14
lea    0xe11(%rip),%rdi
mov    $0x1,%r13d
mov    $0x85,%esi
mov    $0x1,%edx
mov    %rbp,0x10(%rsp)
mov    %rbp,%rcx
call   10f0 <fwrite@plt>
mov    %ebx,%eax
mov    %rax,0x30(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0xffffffff,%ebx
lea    0xe5f(%rip),%rsi
lea    0xe5b(%rip),%rbp
movabs $0x100000600,%r15
mov    %r12,0x18(%rsp)
mov    (%r12,%r13,8),%rdi
call   10e0 <fopen@plt>
mov    %rax,0x28(%rsp)
test   %rax,%rax
je     1511 <main+0x341>
mov    %r13,0x20(%rsp)
xor    %r13d,%r13d
mov    %ebx,%ecx
mov    0x28(%rsp),%r12
mov    %ebx,0xc(%rsp)
mov    %r14,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1418 <main+0x248>
add    $0x1,%r13d
mov    %r14,%rdi
mov    %rbp,%rsi
call   10d0 <strpbrk@plt>
mov    %r14,%rbx
test   %rax,%rax
je     1334 <main+0x164>
nopl   (%rax)
movzbl (%rax),%ecx
cmp    $0x3b,%cl
je     1320 <main+0x150>
add    $0x1,%rax
movsbl %cl,%esi
mov    %rax,%rdi
call   1070 <strchr@plt>
test   %rax,%rax
je     149a <main+0x2ca>
add    $0x1,%rax
mov    %rax,%rdi
mov    %rbp,%rsi
call   10d0 <strpbrk@plt>
test   %rax,%rax
jne    12e0 <main+0x110>
jmp    1323 <main+0x153>
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%rax)
mov    %r14,%rbx
jmp    1334 <main+0x164>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1330 <main+0x160>
cmp    $0x9,%al
je     1330 <main+0x160>
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %rax,%rax
je     12ad <main+0xdd>
movzbl -0x1(%rbx,%rax,1),%ecx
cmp    $0x20,%rcx
ja     1371 <main+0x1a1>
bt     %rcx,%r15
jae    1371 <main+0x1a1>
movb   $0x0,-0x1(%rbx,%rax,1)
add    $0xffffffffffffffff,%rax
jne    1350 <main+0x180>
jmp    12ad <main+0xdd>
mov    %rbx,%rdi
lea    0xd7a(%rip),%rsi
call   10a0 <strcmp@plt>
mov    0x8(%rsp),%ecx
test   %rax,%rax
jne    1392 <main+0x1c2>
mov    %ecx,0xc(%rsp)
jmp    12ad <main+0xdd>
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xd64(%rip),%rdi
mov    0x10(%rsp),%rcx
call   10f0 <fwrite@plt>
jmp    13d4 <main+0x204>
nop
mov    $0x5c,%edi
mov    0x10(%rsp),%r12
mov    %r12,%rsi
call   1080 <fputc@plt>
movzbl (%rbx),%eax
movsbl %al,%edi
mov    %r12,%rsi
call   1080 <fputc@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x22,%al
je     13b0 <main+0x1e0>
cmp    $0x5c,%al
je     13b0 <main+0x1e0>
test   %al,%al
mov    0x10(%rsp),%r12
jne    13c5 <main+0x1f5>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xd14(%rip),%rdi
mov    %r12,%rcx
call   10f0 <fwrite@plt>
addl   $0x1,0x8(%rsp)
mov    0xc(%rsp),%ecx
mov    0x28(%rsp),%r12
mov    %ecx,0xc(%rsp)
jmp    12ad <main+0xdd>
mov    0x18(%rsp),%r12
mov    0x20(%rsp),%r13
mov    0xc(%rsp),%ebx
mov    0x28(%rsp),%rdi
call   1050 <fclose@plt>
add    $0x1,%r13
cmp    0x30(%rsp),%r13
lea    0xc8c(%rip),%rsi
jne    1283 <main+0xb3>
lea    0xcc4(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %ebx,%ebp
mov    0x10(%rsp),%rbx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
cmp    $0xffffffff,%ebp
mov    0x8(%rsp),%edx
cmovne %ebp,%edx
lea    0xca7(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x2b38(%rip),%rax
jmp    1500 <main+0x330>
mov    0x20(%rsp),%eax
mov    0x2b3b(%rip),%rcx
movslq (%rcx),%rdi
mov    0x18(%rsp),%rcx
mov    (%rcx,%rax,8),%rdx
lea    0xc1b(%rip),%rsi
mov    %r13d,%ecx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
lea    0xb4c(%rip),%rdi
call   1040 <remove@plt>
jmp    14f9 <main+0x329>
mov    0x2aff(%rip),%rax
movslq (%rax),%rdi
lea    0xb45(%rip),%rsi
lea    0xb2d(%rip),%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x2ad8(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13d,%eax
mov    0x2ac5(%rip),%rcx
movslq (%rcx),%rdi
mov    (%r12,%rax,8),%rdx
lea    0xb07(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    14c2 <main+0x2f2>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: %s <file> [<file> ...]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [14 x i8] c"nasm-macros.c\00"
@.str.2 = [3 x i8] c"wt\00"
@.str.3 = [22 x i8] c"Could not open `%s'.\0A\00"
@.str.4 = [134 x i8] c"/* This file auto-generated from standard.mac by genmacro.c - don't edit it */\0A\0A#include <stddef.h>\0A\0Astatic const char *stdmac[] = {\0A\00"
@.str.5 = [3 x i8] c"rt\00"
@.str.6 = [4 x i8] c"'\22;\00"
@.str.7 = [34 x i8] c"%s:%d: error: unterminated quote\0A\00"
@.str.8 = [18 x i8] c"*END*TASM*MACROS*\00"
@.str.9 = [6 x i8] c" \22\00"
@.str.10 = [4 x i8] c"\22,\0A\00"
@.str.11 = [13 x i8] c" NULL\0A};\0A\00"
@.str.12 = [29 x i8] c"#define TASM_MACRO_COUNT %d\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 i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
store i32 0, i32* %14
store i32 -1, i32* %15
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %28
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
store i32 %27, i32* %3
br label %242
28: ; preds = %2
%29 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %29, i32** %7
%30 = load i32*, i32** %7
%31 = icmp ne i32* %30, null
br i1 %31, label %38, label %32
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i32*
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%37 = load i32, i32* @EXIT_FAILURE
store i32 %37, i32* %3
br label %242
38: ; preds = %28
%39 = call i8* @malloc(i32 1024)
store i8* %39, i8** %9
%40 = load i32*, i32** %7
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %8
br label %42
42: ; preds = %223, %38
%43 = load i32, i32* %8
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %226
46: ; preds = %42
%47 = load i8**, i8*** %5
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32* @fopen(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %52, i32** %6
%53 = load i32*, i32** %6
%54 = icmp ne i32* %53, null
br i1 %54, label %69, label %55
55: ; preds = %46
%56 = load i32, i32* @stderr
%57 = sext i32 %56 to i64
%58 = inttoptr i64 %57 to i32*
%59 = load i8**, i8*** %5
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %63)
%65 = load i32*, i32** %7
%66 = call i32 @fclose(i32* %65)
%67 = call i32 @remove(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%68 = load i32, i32* @EXIT_FAILURE
store i32 %68, i32* %3
br label %242
69: ; preds = %46
store i32 0, i32* %12
br label %70
70: ; preds = %215, %185, %180, %69
%71 = load i8*, i8** %9
%72 = load i32*, i32** %6
%73 = call i64 @fgets(i8* %71, i32 1024, i32* %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %220
75: ; preds = %70
%76 = load i32, i32* %13
%77 = add nsw i32 %76, 1
store i32 %77, i32* %13
%78 = load i32, i32* %12
%79 = add nsw i32 %78, 1
store i32 %79, i32* %12
%80 = load i8*, i8** %9
store i8* %80, i8** %10
%81 = load i8*, i8** %10
store i8* %81, i8** %11
br label %82
82: ; preds = %117, %75
%83 = load i8*, i8** %11
%84 = call i8* @strpbrk(i8* %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i8* %84, i8** %11
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %120
86: ; preds = %82
%87 = load i8*, i8** %11
%88 = getelementptr inbounds i8, i8* %87, i64 0
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 59
br i1 %91, label %92, label %94
92: ; preds = %86
%93 = load i8*, i8** %11
store i8 0, i8* %93
br label %120
94: ; preds = %86
%95 = load i8*, i8** %11
%96 = getelementptr inbounds i8, i8* %95, i64 1
%97 = load i8*, i8** %11
%98 = getelementptr inbounds i8, i8* %97, i64 0
%99 = load i8, i8* %98
%100 = call i8* @strchr(i8* %96, i8 signext %99)
store i8* %100, i8** %11
%101 = icmp eq i8* %100, null
br i1 %101, label %102, label %117
102: ; preds = %94
%103 = load i32, i32* @stderr
%104 = sext i32 %103 to i64
%105 = inttoptr i64 %104 to i32*
%106 = load i8**, i8*** %5
%107 = load i32, i32* %8
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8*, i8** %106, i64 %108
%110 = load i8*, i8** %109
%111 = load i32, i32* %12
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %110, i32 %111)
%113 = load i32*, i32** %7
%114 = call i32 @fclose(i32* %113)
%115 = call i32 @remove(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%116 = load i32, i32* @EXIT_FAILURE
store i32 %116, i32* %3
br label %242
117: ; preds = %94
%118 = load i8*, i8** %11
%119 = getelementptr inbounds i8, i8* %118, i32 1
store i8* %119, i8** %11
br label %82
120: ; preds = %92, %82
br label %121
121: ; preds = %133, %120
%122 = load i8*, i8** %10
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = icmp eq i32 %124, 32
br i1 %125, label %131, label %126
126: ; preds = %121
%127 = load i8*, i8** %10
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp eq i32 %129, 9
br label %131
131: ; preds = %126, %121
%132 = phi i1 [ true, %121 ], [ %130, %126 ]
br i1 %132, label %133, label %136
133: ; preds = %131
%134 = load i8*, i8** %10
%135 = getelementptr inbounds i8, i8* %134, i32 1
store i8* %135, i8** %10
br label %121
136: ; preds = %131
%137 = load i8*, i8** %10
%138 = call i64 @strlen(i8* %137)
store i64 %138, i64* %16
br label %139
139: ; preds = %170, %136
%140 = load i64, i64* %16
%141 = icmp ugt i64 %140, 0
br i1 %141, label %142, label %168
142: ; preds = %139
%143 = load i8*, i8** %10
%144 = load i64, i64* %16
%145 = sub i64 %144, 1
%146 = getelementptr inbounds i8, i8* %143, i64 %145
%147 = load i8, i8* %146
%148 = sext i8 %147 to i32
%149 = icmp eq i32 %148, 32
br i1 %149, label %166, label %150
150: ; preds = %142
%151 = load i8*, i8** %10
%152 = load i64, i64* %16
%153 = sub i64 %152, 1
%154 = getelementptr inbounds i8, i8* %151, i64 %153
%155 = load i8, i8* %154
%156 = sext i8 %155 to i32
%157 = icmp eq i32 %156, 9
br i1 %157, label %166, label %158
158: ; preds = %150
%159 = load i8*, i8** %10
%160 = load i64, i64* %16
%161 = sub i64 %160, 1
%162 = getelementptr inbounds i8, i8* %159, i64 %161
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = icmp eq i32 %164, 10
br label %166
166: ; preds = %158, %150, %142
%167 = phi i1 [ true, %150 ], [ true, %142 ], [ %165, %158 ]
br label %168
168: ; preds = %166, %139
%169 = phi i1 [ false, %139 ], [ %167, %166 ]
br i1 %169, label %170, label %177
170: ; preds = %168
%171 = load i8*, i8** %10
%172 = load i64, i64* %16
%173 = sub i64 %172, 1
%174 = getelementptr inbounds i8, i8* %171, i64 %173
store i8 0, i8* %174
%175 = load i64, i64* %16
%176 = add i64 %175, -1
store i64 %176, i64* %16
br label %139
177: ; preds = %168
%178 = load i64, i64* %16
%179 = icmp eq i64 %178, 0
br i1 %179, label %180, label %181
180: ; preds = %177
br label %70
181: ; preds = %177
%182 = load i8*, i8** %10
%183 = call i64 @strcmp(i8* %182, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%184 = icmp eq i64 %183, 0
br i1 %184, label %185, label %187
185: ; preds = %181
%186 = load i32, i32* %14
store i32 %186, i32* %15
br label %70
187: ; preds = %181
%188 = load i32*, i32** %7
%189 = call i32 (i32*, i8*, ...) @fprintf(i32* %188, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %190
190: ; preds = %208, %187
%191 = load i8*, i8** %10
%192 = load i8, i8* %191
%193 = sext i8 %192 to i32
%194 = icmp ne i32 %193, 0
br i1 %194, label %195, label %215
195: ; preds = %190
%196 = load i8*, i8** %10
%197 = load i8, i8* %196
%198 = sext i8 %197 to i32
%199 = icmp eq i32 %198, 92
br i1 %199, label %205, label %200
200: ; preds = %195
%201 = load i8*, i8** %10
%202 = load i8, i8* %201
%203 = sext i8 %202 to i32
%204 = icmp eq i32 %203, 34
br i1 %204, label %205, label %208
205: ; preds = %200, %195
%206 = load i32*, i32** %7
%207 = call i32 @fputc(i8 signext 92, i32* %206)
br label %208
208: ; preds = %205, %200
%209 = load i8*, i8** %10
%210 = load i8, i8* %209
%211 = load i32*, i32** %7
%212 = call i32 @fputc(i8 signext %210, i32* %211)
%213 = load i8*, i8** %10
%214 = getelementptr inbounds i8, i8* %213, i32 1
store i8* %214, i8** %10
br label %190
215: ; preds = %190
%216 = load i32*, i32** %7
%217 = call i32 (i32*, i8*, ...) @fprintf(i32* %216, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%218 = load i32, i32* %14
%219 = add nsw i32 %218, 1
store i32 %219, i32* %14
br label %70
220: ; preds = %70
%221 = load i32*, i32** %6
%222 = call i32 @fclose(i32* %221)
br label %223
223: ; preds = %220
%224 = load i32, i32* %8
%225 = add nsw i32 %224, 1
store i32 %225, i32* %8
br label %42
226: ; preds = %42
%227 = load i32*, i32** %7
%228 = call i32 (i32*, i8*, ...) @fprintf(i32* %227, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%229 = load i32, i32* %15
%230 = icmp eq i32 %229, -1
br i1 %230, label %231, label %233
231: ; preds = %226
%232 = load i32, i32* %14
store i32 %232, i32* %15
br label %233
233: ; preds = %231, %226
%234 = load i32*, i32** %7
%235 = load i32, i32* %15
%236 = call i32 (i32*, i8*, ...) @fprintf(i32* %234, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %235)
%237 = load i32*, i32** %7
%238 = call i32 @fclose(i32* %237)
%239 = load i8*, i8** %9
%240 = call i32 @free(i8* %239)
%241 = load i32, i32* @EXIT_SUCCESS
store i32 %241, i32* %3
br label %242
242: ; preds = %233, %102, %55, %32, %19
%243 = load i32, i32* %3
ret i32 %243
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: %s <file> [<file> ...]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [14 x i8] c"nasm-macros.c\00"
@.str.2 = [3 x i8] c"wt\00"
@.str.3 = [22 x i8] c"Could not open `%s'.\0A\00"
@.str.4 = [134 x i8] c"/* This file auto-generated from standard.mac by genmacro.c - don't edit it */\0A\0A#include <stddef.h>\0A\0Astatic const char *stdmac[] = {\0A\00"
@.str.5 = [3 x i8] c"rt\00"
@.str.6 = [4 x i8] c"'\22;\00"
@.str.7 = [34 x i8] c"%s:%d: error: unterminated quote\0A\00"
@.str.8 = [18 x i8] c"*END*TASM*MACROS*\00"
@.str.9 = [6 x i8] c" \22\00"
@.str.10 = [4 x i8] c"\22,\0A\00"
@.str.11 = [13 x i8] c" NULL\0A};\0A\00"
@.str.12 = [29 x i8] c"#define TASM_MACRO_COUNT %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load i8*, i8** %1
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %125
10: ; preds = %2
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %125
18: ; preds = %10
%19 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.4, i64 0, i64 0), i64 133, i64 1, i32* %11)
%21 = zext i32 %0 to i64
br label %22
22: ; preds = %18, %114
%23 = phi i64 [ 1, %18 ], [ %116, %114 ]
%24 = phi i32 [ -1, %18 ], [ %92, %114 ]
%25 = phi i32 [ 0, %18 ], [ %112, %114 ]
%26 = getelementptr inbounds i8*, i8** %1, i64 %23
%27 = load i8*, i8** %26
%28 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %110
30: ; preds = %22
%31 = and i64 %23, 4294967295
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i32, i32* @stderr
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i32*
%36 = load i8*, i8** %32
%37 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %36)
%38 = tail call i32 @fclose(i32* %11)
%39 = tail call i32 @remove(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %125
40: ; preds = %85, %77
%41 = tail call i64 @fgets(i8* %19, i32 1024, i32* %28)
%42 = icmp eq i64 %41, 0
br i1 %42, label %114, label %43
43: ; preds = %90, %40
%44 = phi i32 [ %45, %40 ], [ %91, %90 ]
%45 = add nsw i32 %44, 1
%46 = tail call i8* @strpbrk(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i8* %46, null
br i1 %47, label %57, label %52
48: ; preds = %58
%49 = getelementptr inbounds i8, i8* %60, i64 1
%50 = tail call i8* @strpbrk(i8* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i8* %50, null
br i1 %51, label %57, label %52
52: ; preds = %43, %48
%53 = phi i8* [ %50, %48 ], [ %46, %43 ]
%54 = load i8, i8* %53
%55 = icmp eq i8 %54, 59
br i1 %55, label %56, label %58
56: ; preds = %52
store i8 0, i8* %53
br label %57
57: ; preds = %48, %43, %56
br label %72
58: ; preds = %52
%59 = getelementptr inbounds i8, i8* %53, i64 1
%60 = tail call i8* @strchr(i8* %59, i8 signext %54)
%61 = icmp eq i8* %60, null
br i1 %61, label %62, label %48
62: ; preds = %58
%63 = and i64 %23, 4294967295
%64 = getelementptr inbounds i8*, i8** %1, i64 %63
%65 = load i32, i32* @stderr
%66 = sext i32 %65 to i64
%67 = inttoptr i64 %66 to i32*
%68 = load i8*, i8** %64
%69 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %68, i32 %45)
%70 = tail call i32 @fclose(i32* %11)
%71 = tail call i32 @remove(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %125
72: ; preds = %57, %75
%73 = phi i8* [ %76, %75 ], [ %19, %57 ]
%74 = load i8, i8* %73
switch i8 %74, label %77 [
i8 32, label %75
i8 9, label %75
]
75: ; preds = %72, %72
%76 = getelementptr inbounds i8, i8* %73, i64 1
br label %72
77: ; preds = %72
%78 = tail call i64 @strlen(i8* %73)
%79 = icmp eq i64 %78, 0
br i1 %79, label %40, label %80
80: ; preds = %77, %85
%81 = phi i64 [ %82, %85 ], [ %78, %77 ]
%82 = add i64 %81, -1
%83 = getelementptr inbounds i8, i8* %73, i64 %82
%84 = load i8, i8* %83
switch i8 %84, label %87 [
i8 32, label %85
i8 9, label %85
i8 10, label %85
]
85: ; preds = %80, %80, %80
store i8 0, i8* %83
%86 = icmp eq i64 %82, 0
br i1 %86, label %40, label %80
87: ; preds = %80
%88 = tail call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %110, %87
%91 = phi i32 [ %111, %110 ], [ %45, %87 ]
%92 = phi i32 [ %113, %110 ], [ %112, %87 ]
%93 = tail call i64 @fgets(i8* %19, i32 1024, i32* %28)
%94 = icmp eq i64 %93, 0
br i1 %94, label %114, label %43
95: ; preds = %87
%96 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i64 5, i64 1, i32* %11)
br label %97
97: ; preds = %103, %95
%98 = phi i8* [ %73, %95 ], [ %106, %103 ]
%99 = load i8, i8* %98
switch i8 %99, label %103 [
i8 0, label %107
i8 92, label %100
i8 34, label %100
]
100: ; preds = %97, %97
%101 = tail call i32 @fputc(i8 signext 92, i32* %11)
%102 = load i8, i8* %98
br label %103
103: ; preds = %97, %100
%104 = phi i8 [ %99, %97 ], [ %102, %100 ]
%105 = tail call i32 @fputc(i8 signext %104, i32* %11)
%106 = getelementptr inbounds i8, i8* %98, i64 1
br label %97
107: ; preds = %97
%108 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i64 3, i64 1, i32* %11)
%109 = add nsw i32 %112, 1
br label %110
110: ; preds = %22, %107
%111 = phi i32 [ %45, %107 ], [ 0, %22 ]
%112 = phi i32 [ %109, %107 ], [ %25, %22 ]
%113 = phi i32 [ %92, %107 ], [ %24, %22 ]
br label %90
114: ; preds = %90, %40
%115 = tail call i32 @fclose(i32* %28)
%116 = add nuw nsw i64 %23, 1
%117 = icmp eq i64 %116, %21
br i1 %117, label %118, label %22
118: ; preds = %114
%119 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i64 12, i64 1, i32* %11)
%120 = icmp eq i32 %92, -1
%121 = select i1 %120, i32 %112, i32 %92
%122 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %121)
%123 = tail call i32 @fclose(i32* %11)
%124 = tail call i32 @free(i8* %19)
br label %125
125: ; preds = %118, %62, %30, %13, %4
%126 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_FAILURE, %62 ], [ @EXIT_FAILURE, %30 ], [ @EXIT_SUCCESS, %118 ], [ @EXIT_FAILURE, %13 ]
%127 = load i32, i32* %126
ret i32 %127
}