#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 main(void) {
  printf(".text\n");
  printf(".globl __alltraps\n");
  int i;
  for (i = 0; i < 256; i++) {
    printf(".globl vector%d\n", i);
    printf("vector%d:\n", i);
    if ((i < 8 || i > 14) && i != 17) {
      printf("  pushl \\$0\n");
    }
    printf("  pushl $%d\n", i);
    printf("  jmp __alltraps\n");
  }
  printf("\n");
  printf("# vector table\n");
  printf(".data\n");
  printf(".globl __vectors\n");
  printf("__vectors:\n");
  for (i = 0; i < 256; i++) {
    printf("  .long vector%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11ca <main+0xba>
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x8,-0x8(%rbp)
jl     1185 <main+0x75>
cmpl   $0xe,-0x8(%rbp)
jle    119d <main+0x8d>
cmpl   $0x11,-0x8(%rbp)
je     119d <main+0x8d>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x32>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1243 <main+0x133>
mov    -0x8(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1217 <main+0x107>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xef9(%rip),%rdi
call   1040 <puts@plt>
lea    0xef3(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%r14
lea    0xeb0(%rip),%r15
lea    0xeb4(%rip),%r12
lea    0xf15(%rip),%rbx
lea    0xf1f(%rip),%r13
xor    %ebp,%ebp
jmp    119f <main+0x6f>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
je     11ce <main+0x9e>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x8(%rbp),%eax
cmp    $0x7,%eax
jb     1180 <main+0x50>
cmp    $0x11,%ebp
je     1180 <main+0x50>
mov    %r13,%rdi
call   1040 <puts@plt>
jmp    1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
lea    0xe71(%rip),%rdi
call   1040 <puts@plt>
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
lea    0xe1a(%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   1050 <printf@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1220 <main+0xf0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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