#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void write_pairtable(FILE *output, unsigned char pairtable[128][2],
                     char *tablename) {
  int i;
  fprintf(
      output,
      "/*-*SCPACK start of pair table, do not change or remove this line */\n");
  fprintf(output, "unsigned char %s[][2] = {", tablename);
  for (i = 0; i < 128 && pairtable[i][0] != 0 && pairtable[i][1] != 0; i++) {
    if ((i % 16) == 0)
      fprintf(output, "\n  ");
    else
      fprintf(output, " ");
    fprintf(output, "{%d,%d}", pairtable[i][0], pairtable[i][1]);
    if (i + 1 < 128 && pairtable[i + 1][0] != 0 && pairtable[i + 1][1] != 0)
      fprintf(output, ",");
  }
  fprintf(output, "\n};\n");
  fprintf(
      output,
      "/*-*SCPACK end of pair table, do not change or remove this line */\n");
}


x86 assembly (clang, -O0):
<write_pairtable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xf01(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x80,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jge    1195 <write_pairtable+0x85>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,2),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     1195 <write_pairtable+0x85>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl 0x1(%rax,%rcx,2),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11a5 <write_pairtable+0x95>
jmp    1278 <write_pairtable+0x168>
mov    -0x1c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d0 <write_pairtable+0xc0>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e2 <write_pairtable+0xd2>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,2),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl 0x1(%rax,%rcx,2),%ecx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cmp    $0x80,%eax
jge    1265 <write_pairtable+0x155>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
je     1265 <write_pairtable+0x155>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl 0x1(%rax,%rcx,2),%eax
cmp    $0x0,%eax
je     1265 <write_pairtable+0x155>
mov    -0x8(%rbp),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    126a <write_pairtable+0x15a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1153 <write_pairtable+0x43>
mov    -0x8(%rbp),%rdi
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_pairtable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r14
lea    0xeb5(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xee2(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xee8(%rip),%r15
lea    0xee5(%rip),%r12
xor    %ebp,%ebp
jmp    119d <write_pairtable+0x6d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x80,%rbp
je     122e <write_pairtable+0xfe>
cmpb   $0x0,0x0(%r13,%rbp,2)
je     122e <write_pairtable+0xfe>
mov    %rbp,%rbx
cmpb   $0x0,0x1(%r13,%rbp,2)
je     122e <write_pairtable+0xfe>
test   $0xf,%bl
je     11d0 <write_pairtable+0xa0>
mov    $0x20,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
jmp    11e5 <write_pairtable+0xb5>
nopl   0x0(%rax,%rax,1)
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r14,%rcx
call   1050 <fwrite@plt>
movzbl 0x0(%r13,%rbx,2),%edx
movzbl 0x1(%r13,%rbx,2),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0x1(%rbx),%rbp
cmp    $0x7e,%rbx
ja     1190 <write_pairtable+0x60>
cmpb   $0x0,0x2(%r13,%rbx,2)
je     1190 <write_pairtable+0x60>
cmpb   $0x0,0x3(%r13,%rbx,2)
je     1190 <write_pairtable+0x60>
mov    $0x2c,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
jmp    1190 <write_pairtable+0x60>
lea    0xe37(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xe23(%rip),%rdi
mov    $0x43,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fwrite@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"/*-*SCPACK start of pair table, do not change or remove this line */\0A\00"
@.str.1 = [26 x i8] c"unsigned char %s[][2] = {\00"
@.str.2 = [4 x i8] c"\0A \00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [8 x i8] c"{%d,%d}\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [5 x i8] c"\0A};\0A\00"
@.str.7 = [68 x i8] c"/*-*SCPACK end of pair table, do not change or remove this line */\0A\00"
define void @write_pairtable(i32* %0, [2 x i8]* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca [2 x i8]*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %4
store [2 x i8]* %1, [2 x i8]** %5
store i8* %2, i8** %6
%8 = load i32*, i32** %4
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %4
%11 = load i8*, i8** %6
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %11)
store i32 0, i32* %7
br label %13
13: ; preds = %90, %3
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 128
br i1 %15, label %16, label %34
16: ; preds = %13
%17 = load [2 x i8]*, [2 x i8]** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 %19
%21 = getelementptr inbounds [2 x i8], [2 x i8]* %20, i64 0, i64 0
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %16
%26 = load [2 x i8]*, [2 x i8]** %5
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %26, i64 %28
%30 = getelementptr inbounds [2 x i8], [2 x i8]* %29, i64 0, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = icmp ne i32 %32, 0
br label %34
34: ; preds = %25, %16, %13
%35 = phi i1 [ false, %16 ], [ false, %13 ], [ %33, %25 ]
br i1 %35, label %36, label %93
36: ; preds = %34
%37 = load i32, i32* %7
%38 = srem i32 %37, 16
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i32*, i32** %4
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %46
43: ; preds = %36
%44 = load i32*, i32** %4
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %43, %40
%47 = load i32*, i32** %4
%48 = load [2 x i8]*, [2 x i8]** %5
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [2 x i8], [2 x i8]* %48, i64 %50
%52 = getelementptr inbounds [2 x i8], [2 x i8]* %51, i64 0, i64 0
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = load [2 x i8]*, [2 x i8]** %5
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [2 x i8], [2 x i8]* %55, i64 %57
%59 = getelementptr inbounds [2 x i8], [2 x i8]* %58, i64 0, i64 1
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %54, i32 %61)
%63 = load i32, i32* %7
%64 = add nsw i32 %63, 1
%65 = icmp slt i32 %64, 128
br i1 %65, label %66, label %89
66: ; preds = %46
%67 = load [2 x i8]*, [2 x i8]** %5
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [2 x i8], [2 x i8]* %67, i64 %70
%72 = getelementptr inbounds [2 x i8], [2 x i8]* %71, i64 0, i64 0
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %89
76: ; preds = %66
%77 = load [2 x i8]*, [2 x i8]** %5
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [2 x i8], [2 x i8]* %77, i64 %80
%82 = getelementptr inbounds [2 x i8], [2 x i8]* %81, i64 0, i64 1
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %76
%87 = load i32*, i32** %4
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %89
89: ; preds = %86, %76, %66, %46
br label %90
90: ; preds = %89
%91 = load i32, i32* %7
%92 = add nsw i32 %91, 1
store i32 %92, i32* %7
br label %13
93: ; preds = %34
%94 = load i32*, i32** %4
%95 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%96 = load i32*, i32** %4
%97 = call i32 (i32*, i8*, ...) @fprintf(i32* %96, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"/*-*SCPACK start of pair table, do not change or remove this line */\0A\00"
@.str.1 = [26 x i8] c"unsigned char %s[][2] = {\00"
@.str.2 = [4 x i8] c"\0A \00"
@.str.4 = [8 x i8] c"{%d,%d}\00"
@.str.6 = [5 x i8] c"\0A};\0A\00"
@.str.7 = [68 x i8] c"/*-*SCPACK end of pair table, do not change or remove this line */\0A\00"
define void @write_pairtable(i32* nocapture %0, [2 x i8]* nocapture %1, i8* %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i64 69, i64 1, i32* %0)
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %6
6: ; preds = %3, %40
%7 = phi i64 [ 0, %3 ], [ %28, %40 ]
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 %7, i64 0
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %42, label %11
11: ; preds = %6
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %42, label %15
15: ; preds = %11
%16 = and i64 %7, 15
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 3, i64 1, i32* %0)
br label %22
20: ; preds = %15
%21 = tail call i32 @fputc(i32 32, i32* %0)
br label %22
22: ; preds = %20, %18
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = load i8, i8* %12
%26 = zext i8 %25 to i32
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %24, i32 %26)
%28 = add nuw nsw i64 %7, 1
%29 = icmp ult i64 %7, 127
br i1 %29, label %30, label %40
30: ; preds = %22
%31 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 %28, i64 0
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %40, label %34
34: ; preds = %30
%35 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 %28, i64 1
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = tail call i32 @fputc(i32 44, i32* %0)
br label %40
40: ; preds = %22, %30, %34, %38
%41 = icmp eq i64 %28, 128
br i1 %41, label %42, label %6
42: ; preds = %40, %6, %11
%43 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 4, i64 1, i32* %0)
%44 = tail call i64 @fwrite(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.7, i64 0, i64 0), i64 67, i64 1, i32* %0)
ret void
}