#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  puts(".globl tp_mktf");
  int x;
  for (x = 0; x < 256; x++) {
    printf(".globl handle_int_%d\n", x);
    printf("handle_int_%d:\n", x);
    switch (x) {
    case 8:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 17:
      break;
    default:
      printf("\tpushl $0\n");
      break;
    }
    printf("\tpushl $%d\n", x);
    printf("\tjmp tp_mktf\n");
  }
  printf(".data\n");
  printf(".globl trap_handlers\n");
  printf("trap_handlers:\n");
  for (x = 0; x < 256; x++)
    printf("\t.long handle_int_%d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    11f5 <main+0xd5>
mov    -0x14(%rbp),%esi
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
mov    -0x14(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x8,%eax
je     11b5 <main+0x95>
jmp    1190 <main+0x70>
mov    -0x18(%rbp),%eax
add    $0xfffffff6,%eax
sub    $0x5,%eax
jb     11b5 <main+0x95>
jmp    11a4 <main+0x84>
mov    -0x18(%rbp),%eax
sub    $0x11,%eax
jne    11ba <main+0x9a>
jmp    11b5 <main+0x95>
jmp    11c8 <main+0xa8>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <main+0x29>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    1252 <main+0x132>
mov    -0x14(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1226 <main+0x106>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%r14
lea    0xee0(%rip),%r12
lea    0xee9(%rip),%r13
lea    0xf2e(%rip),%rbx
mov    $0x27d00,%r15d
xor    %ebp,%ebp
jmp    118f <main+0x6f>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
je     11b4 <main+0x94>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x11,%ebp
ja     115d <main+0x3d>
bt     %ebp,%r15d
jb     1170 <main+0x50>
jmp    115d <main+0x3d>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe62(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    11f0 <main+0xd0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c".globl tp_mktf\00"
@.str.1 = [22 x i8] c".globl handle_int_%d\0A\00"
@.str.2 = [16 x i8] c"handle_int_%d:\0A\00"
@.str.3 = [11 x i8] c"\09pushl $0\0A\00"
@.str.4 = [12 x i8] c"\09pushl $%d\0A\00"
@.str.5 = [14 x i8] c"\09jmp tp_mktf\0A\00"
@.str.6 = [7 x i8] c".data\0A\00"
@.str.7 = [22 x i8] c".globl trap_handlers\0A\00"
@.str.8 = [16 x i8] c"trap_handlers:\0A\00"
@.str.9 = [22 x i8] c"\09.long handle_int_%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 256
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %6
switch i32 %16, label %18 [
i32 8, label %17
i32 10, label %17
i32 11, label %17
i32 12, label %17
i32 13, label %17
i32 14, label %17
i32 17, label %17
]
17: ; preds = %11, %11, %11, %11, %11, %11, %11
br label %20
18: ; preds = %11
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %17
%21 = load i32, i32* %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %24
24: ; preds = %20
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %8
27: ; preds = %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %6
br label %31
31: ; preds = %37, %27
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 256
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %31
40: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c".globl tp_mktf\00"
@.str.1 = [22 x i8] c".globl handle_int_%d\0A\00"
@.str.2 = [16 x i8] c"handle_int_%d:\0A\00"
@.str.4 = [12 x i8] c"\09pushl $%d\0A\00"
@.str.9 = [22 x i8] c"\09.long handle_int_%d\0A\00"
@str = [6 x i8] c".data\00"
@str.10 = [21 x i8] c".globl trap_handlers\00"
@str.11 = [15 x i8] c"trap_handlers:\00"
@str.12 = [13 x i8] c"\09jmp tp_mktf\00"
@str.13 = [10 x i8] c"\09pushl $0\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %2, %10
%5 = phi i32 [ 0, %2 ], [ %13, %10 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %5)
switch i32 %5, label %8 [
i32 8, label %10
i32 10, label %10
i32 11, label %10
i32 12, label %10
i32 13, label %10
i32 14, label %10
i32 17, label %10
]
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.13, i64 0, i64 0))
br label %10
10: ; preds = %4, %4, %4, %4, %4, %4, %4, %8
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %5)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.12, i64 0, i64 0))
%13 = add nuw nsw i32 %5, 1
%14 = icmp eq i32 %13, 256
br i1 %14, label %15, label %4
15: ; preds = %10
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.10, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.11, i64 0, i64 0))
br label %19
19: ; preds = %15, %19
%20 = phi i32 [ 0, %15 ], [ %22, %19 ]
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i32 %20, 1
%23 = icmp eq i32 %22, 256
br i1 %23, label %24, label %19
24: ; preds = %19
ret i32 0
}