#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*/ check_if(char *, int);
int /*<<< orphan*/ check_separator(char *);
scalar_t__ check_tablename(char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ strmatch(char *, char *, int /*<<< orphan*/ *);
unsigned readbuffer(FILE *input, unsigned char *buffer) {
  char str[256];
  unsigned buffersize;
  int i, linenr;
  linenr = 0;
  buffersize = 0;
  rewind(input);
  while (!feof(input)) {
    while (fgets(str, sizeof str, input) != NULL) {
      linenr++;
      check_tablename(str);
      check_separator(str);
      if (strmatch(str, "#ifdef SCPACK", NULL))
        break;
    }
    if (!strmatch(str, "#ifdef SCPACK", NULL))
      return buffersize;
    while (fgets(str, sizeof str, input) != NULL) {
      linenr++;
      check_if(str, linenr);
      if (check_tablename(str))
        printf("Error: table name definition should not be in SCPACK section "
               "(line %d)\n",
               linenr);
      check_separator(str);
      if (strmatch(str, "#else", NULL))
        break;
      i = 0;
      do {
        while (str[i] != '\0' && str[i] != '"')
          i++;
        if (str[i] == '"') {
          i++;
          while (str[i] != '\0' && str[i] != '"') {
            if (str[i] == '\\') {
              i++;
              switch (str[i]) {
              case 'a':
                buffer[buffersize++] = '\a';
                i++;
                break;
              case 'b':
                buffer[buffersize++] = '\b';
                i++;
                break;
              case 'f':
                buffer[buffersize++] = '\f';
                i++;
                break;
              case 'n':
                buffer[buffersize++] = '\n';
                i++;
                break;
              case 'r':
                buffer[buffersize++] = '\n';
                i++;
                break;
              case 't':
                buffer[buffersize++] = '\t';
                i++;
                break;
              case '\'':
                buffer[buffersize++] = '\'';
                i++;
                break;
              case '"':
                buffer[buffersize++] = '"';
                i++;
                break;
              default:
                printf("Unknown escape sequence '\\%c' on line %d\n", str[i],
                       linenr);
              }
            } else {
              buffer[buffersize++] = str[i++];
            }
          }
          if (str[i] == '"') {
            buffer[buffersize++] = '\0';
            i++;
          } else {
            printf("Error: unterminated string on line %d\n", linenr);
          }
        }
      } while (str[i] != '\0');
    }
    buffer[buffersize++] = '\0';
  }
  return buffersize;
}


x86 assembly (clang, -O0):
<readbuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x12c(%rbp)
movl   $0x0,-0x124(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ce <readbuffer+0x4e>
jmp    174b <readbuffer+0x5cb>
jmp    11d3 <readbuffer+0x53>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1244 <readbuffer+0xc4>
mov    -0x12c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12c(%rbp)
lea    -0x120(%rbp),%rdi
call   10a0 <check_tablename@plt>
lea    -0x120(%rbp),%rdi
call   1090 <check_separator@plt>
lea    -0x120(%rbp),%rdi
lea    0xdd9(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <strmatch@plt>
cmp    $0x0,%rax
je     123f <readbuffer+0xbf>
jmp    1244 <readbuffer+0xc4>
jmp    11d3 <readbuffer+0x53>
lea    -0x120(%rbp),%rdi
lea    0xdae(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <strmatch@plt>
cmp    $0x0,%rax
jne    1273 <readbuffer+0xf3>
mov    -0x124(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1754 <readbuffer+0x5d4>
jmp    1278 <readbuffer+0xf8>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     172b <readbuffer+0x5ab>
mov    -0x12c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12c(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x12c(%rbp),%esi
call   1060 <check_if@plt>
lea    -0x120(%rbp),%rdi
call   10a0 <check_tablename@plt>
cmp    $0x0,%rax
je     12e2 <readbuffer+0x162>
mov    -0x12c(%rbp),%esi
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x120(%rbp),%rdi
call   1090 <check_separator@plt>
lea    -0x120(%rbp),%rdi
lea    0xd5a(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <strmatch@plt>
cmp    $0x0,%rax
je     1314 <readbuffer+0x194>
jmp    172b <readbuffer+0x5ab>
movl   $0x0,-0x128(%rbp)
jmp    1323 <readbuffer+0x1a3>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x12d(%rbp)
je     135e <readbuffer+0x1de>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
setne  %al
mov    %al,-0x12d(%rbp)
mov    -0x12d(%rbp),%al
test   $0x1,%al
jne    1371 <readbuffer+0x1f1>
jmp    1385 <readbuffer+0x205>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    1323 <readbuffer+0x1a3>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
jne    1709 <readbuffer+0x589>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x12e(%rbp)
je     13e7 <readbuffer+0x267>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
setne  %al
mov    %al,-0x12e(%rbp)
mov    -0x12e(%rbp),%al
test   $0x1,%al
jne    13fa <readbuffer+0x27a>
jmp    16a9 <readbuffer+0x529>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x5c,%eax
jne    1670 <readbuffer+0x4f0>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
mov    %eax,-0x134(%rbp)
sub    $0x22,%eax
je     1619 <readbuffer+0x499>
jmp    1444 <readbuffer+0x2c4>
mov    -0x134(%rbp),%eax
sub    $0x27,%eax
je     15ea <readbuffer+0x46a>
jmp    1458 <readbuffer+0x2d8>
mov    -0x134(%rbp),%eax
sub    $0x61,%eax
je     14d0 <readbuffer+0x350>
jmp    146c <readbuffer+0x2ec>
mov    -0x134(%rbp),%eax
sub    $0x62,%eax
je     14ff <readbuffer+0x37f>
jmp    1480 <readbuffer+0x300>
mov    -0x134(%rbp),%eax
sub    $0x66,%eax
je     152e <readbuffer+0x3ae>
jmp    1494 <readbuffer+0x314>
mov    -0x134(%rbp),%eax
sub    $0x6e,%eax
je     155d <readbuffer+0x3dd>
jmp    14a8 <readbuffer+0x328>
mov    -0x134(%rbp),%eax
sub    $0x72,%eax
je     158c <readbuffer+0x40c>
jmp    14bc <readbuffer+0x33c>
mov    -0x134(%rbp),%eax
sub    $0x74,%eax
je     15bb <readbuffer+0x43b>
jmp    1648 <readbuffer+0x4c8>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x7,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x8,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0xc,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0xa,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0xa,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x9,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x27,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x22,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    166b <readbuffer+0x4eb>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%esi
ff
mov    -0x12c(%rbp),%edx
lea    0x9f8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    16a4 <readbuffer+0x524>
mov    -0x128(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x128(%rbp)
cltq
mov    -0x120(%rbp,%rax,1),%dl
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x124(%rbp)
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
jmp    13ac <readbuffer+0x22c>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
jne    16f0 <readbuffer+0x570>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    1704 <readbuffer+0x584>
mov    -0x12c(%rbp),%esi
lea    0x989(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1709 <readbuffer+0x589>
jmp    170e <readbuffer+0x58e>
movslq -0x128(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    131e <readbuffer+0x19e>
jmp    1278 <readbuffer+0xf8>
mov    -0x18(%rbp),%rax
mov    -0x124(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x124(%rbp)
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
jmp    11b0 <readbuffer+0x30>
mov    -0x124(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readbuffer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%rbx
mov    %rdi,%r15
call   1050 <rewind@plt>
mov    %r15,%rdi
call   1080 <feof@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11be <readbuffer+0x3e>
mov    %ebp,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r13
lea    0xe36(%rip),%r12
xor    %r14d,%r14d
xor    %ebp,%ebp
mov    %r15,0x8(%rsp)
jmp    11f0 <readbuffer+0x70>
lea    0x10(%rsp),%r13
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x0,(%rbx,%rax,1)
mov    %r15,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    11aa <readbuffer+0x2a>
mov    %r13,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     122f <readbuffer+0xaf>
add    $0x1,%r14d
mov    %r13,%rdi
call   10a0 <check_tablename@plt>
mov    %r13,%rdi
call   1090 <check_separator@plt>
mov    %r13,%rdi
lea    0xe2d(%rip),%rsi
xor    %edx,%edx
call   1030 <strmatch@plt>
test   %rax,%rax
je     11f0 <readbuffer+0x70>
mov    %r13,%rdi
lea    0xe17(%rip),%rsi
xor    %edx,%edx
call   1030 <strmatch@plt>
test   %rax,%rax
je     11aa <readbuffer+0x2a>
mov    %r13,%rdi
mov    $0x100,%esi
jmp    1272 <readbuffer+0xf2>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    $0x100,%esi
mov    0x8(%rsp),%r15
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     11db <readbuffer+0x5b>
add    $0x1,%r14d
mov    %r13,%rdi
mov    %r14d,%esi
call   1060 <check_if@plt>
mov    %r13,%rdi
call   10a0 <check_tablename@plt>
test   %rax,%rax
je     12b0 <readbuffer+0x130>
lea    0xdb8(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%r13
mov    %r13,%rdi
call   1090 <check_separator@plt>
mov    %r13,%rdi
lea    0xddf(%rip),%rsi
xor    %edx,%edx
call   1030 <strmatch@plt>
test   %rax,%rax
jne    11d6 <readbuffer+0x56>
xor    %r15d,%r15d
jmp    12ff <readbuffer+0x17f>
nopl   0x0(%rax)
lea    0xdef(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %r15d,%rax
cmpb   $0x0,0x10(%rsp,%rax,1)
je     1260 <readbuffer+0xe0>
movslq %r15d,%rax
add    %rsp,%rax
add    $0x10,%rax
nopl   0x0(%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     12f1 <readbuffer+0x171>
add    $0x1,%r15d
cmp    $0x22,%cl
je     1334 <readbuffer+0x1b4>
add    $0x1,%rax
jmp    1310 <readbuffer+0x190>
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x7,(%rbx,%rax,1)
nop
add    $0x2,%r15d
movslq %r15d,%r13
movzbl 0x10(%rsp,%r13,1),%eax
cmp    $0x5c,%al
je     1360 <readbuffer+0x1e0>
test   %al,%al
je     12e0 <readbuffer+0x160>
cmp    $0x22,%al
je     13f0 <readbuffer+0x270>
add    $0x1,%r15d
mov    %ebp,%ecx
add    $0x1,%ebp
mov    %al,(%rbx,%rcx,1)
jmp    1334 <readbuffer+0x1b4>
nopl   0x0(%rax,%rax,1)
movsbl 0x11(%rsp,%r13,1),%esi
lea    -0x61(%rsi),%eax
cmp    $0x13,%eax
ja     1382 <readbuffer+0x202>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0xa,(%rbx,%rax,1)
jmp    1330 <readbuffer+0x1b0>
cmp    $0x22,%esi
je     13db <readbuffer+0x25b>
cmp    $0x27,%esi
jne    1397 <readbuffer+0x217>
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x27,(%rbx,%rax,1)
jmp    1330 <readbuffer+0x1b0>
add    $0x1,%r13
lea    0xd0a(%rip),%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%r15d
jmp    1334 <readbuffer+0x1b4>
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x8,(%rbx,%rax,1)
jmp    1330 <readbuffer+0x1b0>
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0xc,(%rbx,%rax,1)
jmp    1330 <readbuffer+0x1b0>
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x9,(%rbx,%rax,1)
jmp    1330 <readbuffer+0x1b0>
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x22,(%rbx,%rax,1)
jmp    1330 <readbuffer+0x1b0>
nopl   0x0(%rax)
mov    %ebp,%eax
add    $0x1,%ebp
movb   $0x0,(%rbx,%rax,1)
add    $0x1,%r15d
jmp    12f1 <readbuffer+0x171>

LLVM IR (-O0):
@.str = [14 x i8] c"#ifdef SCPACK\00"
@.str.1 = [72 x i8] c"Error: table name definition should not be in SCPACK section (line %d)\0A\00"
@.str.2 = [6 x i8] c"#else\00"
@.str.3 = [42 x i8] c"Unknown escape sequence '\\%c' on line %d\0A\00"
@.str.4 = [39 x i8] c"Error: unterminated string on line %d\0A\00"
define i32 @readbuffer(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 0, i32* %9
store i32 0, i32* %7
%10 = load i32*, i32** %4
%11 = call i32 @rewind(i32* %10)
br label %12
12: ; preds = %241, %2
%13 = load i32*, i32** %4
%14 = call i32 @feof(i32* %13)
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %17, label %247
17: ; preds = %12
br label %18
18: ; preds = %34, %17
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%20 = load i32*, i32** %4
%21 = call i32* @fgets(i8* %19, i32 256, i32* %20)
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %35
23: ; preds = %18
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
store i32 %25, i32* %9
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%27 = call i64 @check_tablename(i8* %26)
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%29 = call i32 @check_separator(i8* %28)
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%31 = call i64 @strmatch(i8* %30, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* null)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %23
br label %35
34: ; preds = %23
br label %18
35: ; preds = %33, %18
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%37 = call i64 @strmatch(i8* %36, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* null)
%38 = icmp ne i64 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %35
%40 = load i32, i32* %7
store i32 %40, i32* %3
br label %249
41: ; preds = %35
br label %42
42: ; preds = %240, %41
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%44 = load i32*, i32** %4
%45 = call i32* @fgets(i8* %43, i32 256, i32* %44)
%46 = icmp ne i32* %45, null
br i1 %46, label %47, label %241
47: ; preds = %42
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%51 = load i32, i32* %9
%52 = call i32 @check_if(i8* %50, i32 %51)
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%54 = call i64 @check_tablename(i8* %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %47
%57 = load i32, i32* %9
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %56, %47
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%61 = call i32 @check_separator(i8* %60)
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%63 = call i64 @strmatch(i8* %62, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* null)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %59
br label %241
66: ; preds = %59
store i32 0, i32* %8
br label %67
67: ; preds = %233, %66
br label %68
68: ; preds = %84, %67
%69 = load i32, i32* %8
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %82
75: ; preds = %68
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %77
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp ne i32 %80, 34
br label %82
82: ; preds = %75, %68
%83 = phi i1 [ false, %68 ], [ %81, %75 ]
br i1 %83, label %84, label %87
84: ; preds = %82
%85 = load i32, i32* %8
%86 = add nsw i32 %85, 1
store i32 %86, i32* %8
br label %68
87: ; preds = %82
%88 = load i32, i32* %8
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 34
br i1 %93, label %94, label %232
94: ; preds = %87
%95 = load i32, i32* %8
%96 = add nsw i32 %95, 1
store i32 %96, i32* %8
br label %97
97: ; preds = %212, %94
%98 = load i32, i32* %8
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %99
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %111
104: ; preds = %97
%105 = load i32, i32* %8
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp ne i32 %109, 34
br label %111
111: ; preds = %104, %97
%112 = phi i1 [ false, %97 ], [ %110, %104 ]
br i1 %112, label %113, label %213
113: ; preds = %111
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %115
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 92
br i1 %119, label %120, label %201
120: ; preds = %113
%121 = load i32, i32* %8
%122 = add nsw i32 %121, 1
store i32 %122, i32* %8
%123 = load i32, i32* %8
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %124
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
switch i32 %127, label %192 [
i32 97, label %128
i32 98, label %136
i32 102, label %144
i32 110, label %152
i32 114, label %160
i32 116, label %168
i32 39, label %176
i32 34, label %184
]
128: ; preds = %120
%129 = load i8*, i8** %5
%130 = load i32, i32* %7
%131 = add i32 %130, 1
store i32 %131, i32* %7
%132 = zext i32 %130 to i64
%133 = getelementptr inbounds i8, i8* %129, i64 %132
store i8 7, i8* %133
%134 = load i32, i32* %8
%135 = add nsw i32 %134, 1
store i32 %135, i32* %8
br label %200
136: ; preds = %120
%137 = load i8*, i8** %5
%138 = load i32, i32* %7
%139 = add i32 %138, 1
store i32 %139, i32* %7
%140 = zext i32 %138 to i64
%141 = getelementptr inbounds i8, i8* %137, i64 %140
store i8 8, i8* %141
%142 = load i32, i32* %8
%143 = add nsw i32 %142, 1
store i32 %143, i32* %8
br label %200
144: ; preds = %120
%145 = load i8*, i8** %5
%146 = load i32, i32* %7
%147 = add i32 %146, 1
store i32 %147, i32* %7
%148 = zext i32 %146 to i64
%149 = getelementptr inbounds i8, i8* %145, i64 %148
store i8 12, i8* %149
%150 = load i32, i32* %8
%151 = add nsw i32 %150, 1
store i32 %151, i32* %8
br label %200
152: ; preds = %120
%153 = load i8*, i8** %5
%154 = load i32, i32* %7
%155 = add i32 %154, 1
store i32 %155, i32* %7
%156 = zext i32 %154 to i64
%157 = getelementptr inbounds i8, i8* %153, i64 %156
store i8 10, i8* %157
%158 = load i32, i32* %8
%159 = add nsw i32 %158, 1
store i32 %159, i32* %8
br label %200
160: ; preds = %120
%161 = load i8*, i8** %5
%162 = load i32, i32* %7
%163 = add i32 %162, 1
store i32 %163, i32* %7
%164 = zext i32 %162 to i64
%165 = getelementptr inbounds i8, i8* %161, i64 %164
store i8 10, i8* %165
%166 = load i32, i32* %8
%167 = add nsw i32 %166, 1
store i32 %167, i32* %8
br label %200
168: ; preds = %120
%169 = load i8*, i8** %5
%170 = load i32, i32* %7
%171 = add i32 %170, 1
store i32 %171, i32* %7
%172 = zext i32 %170 to i64
%173 = getelementptr inbounds i8, i8* %169, i64 %172
store i8 9, i8* %173
%174 = load i32, i32* %8
%175 = add nsw i32 %174, 1
store i32 %175, i32* %8
br label %200
176: ; preds = %120
%177 = load i8*, i8** %5
%178 = load i32, i32* %7
%179 = add i32 %178, 1
store i32 %179, i32* %7
%180 = zext i32 %178 to i64
%181 = getelementptr inbounds i8, i8* %177, i64 %180
store i8 39, i8* %181
%182 = load i32, i32* %8
%183 = add nsw i32 %182, 1
store i32 %183, i32* %8
br label %200
184: ; preds = %120
%185 = load i8*, i8** %5
%186 = load i32, i32* %7
%187 = add i32 %186, 1
store i32 %187, i32* %7
%188 = zext i32 %186 to i64
%189 = getelementptr inbounds i8, i8* %185, i64 %188
store i8 34, i8* %189
%190 = load i32, i32* %8
%191 = add nsw i32 %190, 1
store i32 %191, i32* %8
br label %200
192: ; preds = %120
%193 = load i32, i32* %8
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %194
%196 = load i8, i8* %195
%197 = sext i8 %196 to i32
%198 = load i32, i32* %9
%199 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %197, i32 %198)
br label %200
200: ; preds = %192, %184, %176, %168, %160, %152, %144, %136, %128
br label %212
201: ; preds = %113
%202 = load i32, i32* %8
%203 = add nsw i32 %202, 1
store i32 %203, i32* %8
%204 = sext i32 %202 to i64
%205 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %204
%206 = load i8, i8* %205
%207 = load i8*, i8** %5
%208 = load i32, i32* %7
%209 = add i32 %208, 1
store i32 %209, i32* %7
%210 = zext i32 %208 to i64
%211 = getelementptr inbounds i8, i8* %207, i64 %210
store i8 %206, i8* %211
br label %212
212: ; preds = %201, %200
br label %97
213: ; preds = %111
%214 = load i32, i32* %8
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %215
%217 = load i8, i8* %216
%218 = sext i8 %217 to i32
%219 = icmp eq i32 %218, 34
br i1 %219, label %220, label %228
220: ; preds = %213
%221 = load i8*, i8** %5
%222 = load i32, i32* %7
%223 = add i32 %222, 1
store i32 %223, i32* %7
%224 = zext i32 %222 to i64
%225 = getelementptr inbounds i8, i8* %221, i64 %224
store i8 0, i8* %225
%226 = load i32, i32* %8
%227 = add nsw i32 %226, 1
store i32 %227, i32* %8
br label %231
228: ; preds = %213
%229 = load i32, i32* %9
%230 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %229)
br label %231
231: ; preds = %228, %220
br label %232
232: ; preds = %231, %87
br label %233
233: ; preds = %232
%234 = load i32, i32* %8
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %235
%237 = load i8, i8* %236
%238 = sext i8 %237 to i32
%239 = icmp ne i32 %238, 0
br i1 %239, label %67, label %240
240: ; preds = %233
br label %42
241: ; preds = %65, %42
%242 = load i8*, i8** %5
%243 = load i32, i32* %7
%244 = add i32 %243, 1
store i32 %244, i32* %7
%245 = zext i32 %243 to i64
%246 = getelementptr inbounds i8, i8* %242, i64 %245
store i8 0, i8* %246
br label %12
247: ; preds = %12
%248 = load i32, i32* %7
store i32 %248, i32* %3
br label %249
249: ; preds = %247, %39
%250 = load i32, i32* %3
ret i32 %250
}

LLVM IR (-O2):
@.str = [14 x i8] c"#ifdef SCPACK\00"
@.str.1 = [72 x i8] c"Error: table name definition should not be in SCPACK section (line %d)\0A\00"
@.str.2 = [6 x i8] c"#else\00"
@.str.3 = [42 x i8] c"Unknown escape sequence '\\%c' on line %d\0A\00"
@.str.4 = [39 x i8] c"Error: unterminated string on line %d\0A\00"
define i32 @readbuffer(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @rewind(i32* %0)
%6 = call i32 @feof(i32* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %143
8: ; preds = %2, %135
%9 = phi i32 [ %137, %135 ], [ 0, %2 ]
%10 = phi i32 [ %138, %135 ], [ 0, %2 ]
br label %11
11: ; preds = %8, %15
%12 = phi i32 [ %16, %15 ], [ %9, %8 ]
%13 = call i32* @fgets(i8* %4, i32 256, i32* %0)
%14 = icmp eq i32* %13, null
br i1 %14, label %21, label %15
15: ; preds = %11
%16 = add nsw i32 %12, 1
%17 = call i64 @check_tablename(i8* %4)
%18 = call i32 @check_separator(i8* %4)
%19 = call i64 @strmatch(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* null)
%20 = icmp eq i64 %19, 0
br i1 %20, label %11, label %21
21: ; preds = %15, %11
%22 = phi i32 [ %16, %15 ], [ %12, %11 ]
%23 = call i64 @strmatch(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* null)
%24 = icmp eq i64 %23, 0
br i1 %24, label %143, label %25
25: ; preds = %21
%26 = call i32* @fgets(i8* %4, i32 256, i32* %0)
%27 = icmp eq i32* %26, null
br i1 %27, label %135, label %31
28: ; preds = %128
%29 = call i32* @fgets(i8* %4, i32 256, i32* %0)
%30 = icmp eq i32* %29, null
br i1 %30, label %135, label %31
31: ; preds = %25, %28
%32 = phi i32 [ %34, %28 ], [ %22, %25 ]
%33 = phi i32 [ %129, %28 ], [ %10, %25 ]
%34 = add nsw i32 %32, 1
%35 = call i32 @check_if(i8* %4, i32 %34)
%36 = call i64 @check_tablename(i8* %4)
%37 = icmp eq i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %31
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %40
40: ; preds = %38, %31
%41 = call i32 @check_separator(i8* %4)
%42 = call i64 @strmatch(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* null)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %135
44: ; preds = %40, %128
%45 = phi i32 [ %129, %128 ], [ %33, %40 ]
%46 = phi i32 [ %130, %128 ], [ 0, %40 ]
%47 = sext i32 %46 to i64
br label %48
48: ; preds = %52, %44
%49 = phi i64 [ %53, %52 ], [ %47, %44 ]
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %49
%51 = load i8, i8* %50
switch i8 %51, label %52 [
i8 34, label %54
i8 0, label %126
]
52: ; preds = %48
%53 = add i64 %49, 1
br label %48
54: ; preds = %48
%55 = trunc i64 %49 to i32
%56 = add nsw i32 %55, 1
br label %57
57: ; preds = %74, %54
%58 = phi i32 [ %45, %54 ], [ %75, %74 ]
%59 = phi i32 [ %56, %54 ], [ %76, %74 ]
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %60
%62 = load i8, i8* %61
switch i8 %62, label %114 [
i8 92, label %63
i8 34, label %119
i8 0, label %124
]
63: ; preds = %57
%64 = add nsw i32 %59, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
switch i32 %68, label %112 [
i32 97, label %69
i32 98, label %77
i32 102, label %82
i32 110, label %87
i32 114, label %92
i32 116, label %97
i32 39, label %102
i32 34, label %107
]
69: ; preds = %63
%70 = add i32 %58, 1
%71 = zext i32 %58 to i64
%72 = getelementptr inbounds i8, i8* %1, i64 %71
store i8 7, i8* %72
%73 = add nsw i32 %59, 2
br label %74
74: ; preds = %69, %77, %82, %87, %92, %97, %102, %107, %112, %114
%75 = phi i32 [ %58, %112 ], [ %108, %107 ], [ %103, %102 ], [ %98, %97 ], [ %93, %92 ], [ %88, %87 ], [ %83, %82 ], [ %78, %77 ], [ %70, %69 ], [ %116, %114 ]
%76 = phi i32 [ %64, %112 ], [ %111, %107 ], [ %106, %102 ], [ %101, %97 ], [ %96, %92 ], [ %91, %87 ], [ %86, %82 ], [ %81, %77 ], [ %73, %69 ], [ %115, %114 ]
br label %57
77: ; preds = %63
%78 = add i32 %58, 1
%79 = zext i32 %58 to i64
%80 = getelementptr inbounds i8, i8* %1, i64 %79
store i8 8, i8* %80
%81 = add nsw i32 %59, 2
br label %74
82: ; preds = %63
%83 = add i32 %58, 1
%84 = zext i32 %58 to i64
%85 = getelementptr inbounds i8, i8* %1, i64 %84
store i8 12, i8* %85
%86 = add nsw i32 %59, 2
br label %74
87: ; preds = %63
%88 = add i32 %58, 1
%89 = zext i32 %58 to i64
%90 = getelementptr inbounds i8, i8* %1, i64 %89
store i8 10, i8* %90
%91 = add nsw i32 %59, 2
br label %74
92: ; preds = %63
%93 = add i32 %58, 1
%94 = zext i32 %58 to i64
%95 = getelementptr inbounds i8, i8* %1, i64 %94
store i8 10, i8* %95
%96 = add nsw i32 %59, 2
br label %74
97: ; preds = %63
%98 = add i32 %58, 1
%99 = zext i32 %58 to i64
%100 = getelementptr inbounds i8, i8* %1, i64 %99
store i8 9, i8* %100
%101 = add nsw i32 %59, 2
br label %74
102: ; preds = %63
%103 = add i32 %58, 1
%104 = zext i32 %58 to i64
%105 = getelementptr inbounds i8, i8* %1, i64 %104
store i8 39, i8* %105
%106 = add nsw i32 %59, 2
br label %74
107: ; preds = %63
%108 = add i32 %58, 1
%109 = zext i32 %58 to i64
%110 = getelementptr inbounds i8, i8* %1, i64 %109
store i8 34, i8* %110
%111 = add nsw i32 %59, 2
br label %74
112: ; preds = %63
%113 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %68, i32 %34)
br label %74
114: ; preds = %57
%115 = add nsw i32 %59, 1
%116 = add i32 %58, 1
%117 = zext i32 %58 to i64
%118 = getelementptr inbounds i8, i8* %1, i64 %117
store i8 %62, i8* %118
br label %74
119: ; preds = %57
%120 = add i32 %58, 1
%121 = zext i32 %58 to i64
%122 = getelementptr inbounds i8, i8* %1, i64 %121
store i8 0, i8* %122
%123 = add nsw i32 %59, 1
br label %128
124: ; preds = %57
%125 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %34)
br label %128
126: ; preds = %48
%127 = trunc i64 %49 to i32
br label %128
128: ; preds = %126, %124, %119
%129 = phi i32 [ %120, %119 ], [ %58, %124 ], [ %45, %126 ]
%130 = phi i32 [ %123, %119 ], [ %59, %124 ], [ %127, %126 ]
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %131
%133 = load i8, i8* %132
%134 = icmp eq i8 %133, 0
br i1 %134, label %28, label %44
135: ; preds = %28, %40, %25
%136 = phi i32 [ %10, %25 ], [ %33, %40 ], [ %129, %28 ]
%137 = phi i32 [ %22, %25 ], [ %34, %40 ], [ %34, %28 ]
%138 = add i32 %136, 1
%139 = zext i32 %136 to i64
%140 = getelementptr inbounds i8, i8* %1, i64 %139
store i8 0, i8* %140
%141 = call i32 @feof(i32* %0)
%142 = icmp eq i32 %141, 0
br i1 %142, label %8, label %143
143: ; preds = %21, %135, %2
%144 = phi i32 [ 0, %2 ], [ %138, %135 ], [ %10, %21 ]
ret i32 %144
}