#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*/ addbc();
int /*<<< orphan*/ callrts(char *);
int /*<<< orphan*/ const2(int);
int /*<<< orphan*/ doublereg();
int /*<<< orphan*/ fivereg();
int /*<<< orphan*/ ol(char *);
int /*<<< orphan*/ sixreg();
int /*<<< orphan*/ threereg();
void quikmult(int size, char preserve) {
  switch (size) {
  case 16:
    doublereg();
  case 8:
    doublereg();
  case 4:
    doublereg();
  case 2:
    doublereg();
    break;
  case 12:
    doublereg();
  case 6:
    sixreg();
    break;
  case 9:
    threereg();
  case 3:
    threereg();
    break;
  case 15:
    threereg();
  case 5:
    fivereg();
    break;
  case 10:
    fivereg();
    doublereg();
    break;
  case 14:
    doublereg();
  case 7:
    sixreg();
    addbc();
    break;
  default:
    if (preserve)
      ol("push\tde");
    const2(size);
    callrts("l_mult");
    if (preserve)
      ol("pop\tde");
    break;
  }
}


x86 assembly (clang, -O0):
<quikmult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xe,%eax
ja     1241 <quikmult+0xc1>
mov    -0x10(%rbp),%rax
lea    0xe4f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <doublereg@plt>
mov    $0x0,%al
call   10a0 <doublereg@plt>
mov    $0x0,%al
call   10a0 <doublereg@plt>
mov    $0x0,%al
call   10a0 <doublereg@plt>
jmp    1286 <quikmult+0x106>
mov    $0x0,%al
call   10a0 <doublereg@plt>
mov    $0x0,%al
call   1050 <sixreg@plt>
jmp    1286 <quikmult+0x106>
mov    $0x0,%al
call   1070 <threereg@plt>
mov    $0x0,%al
call   1070 <threereg@plt>
jmp    1286 <quikmult+0x106>
mov    $0x0,%al
call   1070 <threereg@plt>
mov    $0x0,%al
call   1030 <fivereg@plt>
jmp    1286 <quikmult+0x106>
mov    $0x0,%al
call   1030 <fivereg@plt>
mov    $0x0,%al
call   10a0 <doublereg@plt>
jmp    1286 <quikmult+0x106>
mov    $0x0,%al
call   10a0 <doublereg@plt>
mov    $0x0,%al
call   1050 <sixreg@plt>
mov    $0x0,%al
call   1090 <addbc@plt>
jmp    1286 <quikmult+0x106>
cmpb   $0x0,-0x5(%rbp)
je     1257 <quikmult+0xd7>
lea    0xdea(%rip),%rdi
call   1080 <ol@plt>
mov    -0x4(%rbp),%edi
call   1060 <const2@plt>
lea    0xdde(%rip),%rdi
call   1040 <callrts@plt>
cmpb   $0x0,-0x5(%rbp)
je     1281 <quikmult+0x101>
lea    0xdcf(%rip),%rdi
call   1080 <ol@plt>
jmp    1286 <quikmult+0x106>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quikmult>:
push   %rbx
mov    %edi,%ebx
lea    -0x2(%rbx),%eax
cmp    $0xe,%eax
ja     11b3 <quikmult+0x33>
lea    0xe6e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <threereg@plt>
xor    %eax,%eax
pop    %rbx
jmp    1070 <threereg@plt>
xor    %eax,%eax
call   1030 <fivereg@plt>
jmp    122d <quikmult+0xad>
test   %sil,%sil
je     1235 <quikmult+0xb5>
lea    0xe7d(%rip),%rdi
call   1080 <ol@plt>
mov    %ebx,%edi
call   1060 <const2@plt>
lea    0xe72(%rip),%rdi
call   1040 <callrts@plt>
lea    0xe6d(%rip),%rdi
pop    %rbx
jmp    1080 <ol@plt>
xor    %eax,%eax
call   10a0 <doublereg@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <sixreg@plt>
xor    %eax,%eax
call   10a0 <doublereg@plt>
xor    %eax,%eax
call   1050 <sixreg@plt>
xor    %eax,%eax
pop    %rbx
jmp    1090 <addbc@plt>
xor    %eax,%eax
call   1070 <threereg@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <fivereg@plt>
xor    %eax,%eax
call   10a0 <doublereg@plt>
xor    %eax,%eax
call   10a0 <doublereg@plt>
xor    %eax,%eax
call   10a0 <doublereg@plt>
xor    %eax,%eax
pop    %rbx
jmp    10a0 <doublereg@plt>
mov    %ebx,%edi
call   1060 <const2@plt>
lea    0xe01(%rip),%rdi
pop    %rbx
jmp    1040 <callrts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"push\09de\00"
@.str.1 = [7 x i8] c"l_mult\00"
@.str.2 = [7 x i8] c"pop\09de\00"
define void @quikmult(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
switch i32 %5, label %34 [
i32 16, label %6
i32 8, label %8
i32 4, label %10
i32 2, label %12
i32 12, label %14
i32 6, label %16
i32 9, label %18
i32 3, label %20
i32 15, label %22
i32 5, label %24
i32 10, label %26
i32 14, label %29
i32 7, label %31
]
6: ; preds = %2
%7 = call i32 (...) @doublereg()
br label %8
8: ; preds = %2, %6
%9 = call i32 (...) @doublereg()
br label %10
10: ; preds = %2, %8
%11 = call i32 (...) @doublereg()
br label %12
12: ; preds = %2, %10
%13 = call i32 (...) @doublereg()
br label %48
14: ; preds = %2
%15 = call i32 (...) @doublereg()
br label %16
16: ; preds = %2, %14
%17 = call i32 (...) @sixreg()
br label %48
18: ; preds = %2
%19 = call i32 (...) @threereg()
br label %20
20: ; preds = %2, %18
%21 = call i32 (...) @threereg()
br label %48
22: ; preds = %2
%23 = call i32 (...) @threereg()
br label %24
24: ; preds = %2, %22
%25 = call i32 (...) @fivereg()
br label %48
26: ; preds = %2
%27 = call i32 (...) @fivereg()
%28 = call i32 (...) @doublereg()
br label %48
29: ; preds = %2
%30 = call i32 (...) @doublereg()
br label %31
31: ; preds = %2, %29
%32 = call i32 (...) @sixreg()
%33 = call i32 (...) @addbc()
br label %48
34: ; preds = %2
%35 = load i8, i8* %4
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @ol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = load i32, i32* %3
%41 = call i32 @const2(i32 %40)
%42 = call i32 @callrts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%43 = load i8, i8* %4
%44 = icmp ne i8 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %39
%46 = call i32 @ol(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %39
br label %48
48: ; preds = %47, %31, %26, %24, %20, %16, %12
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"push\09de\00"
@.str.1 = [7 x i8] c"l_mult\00"
@.str.2 = [7 x i8] c"pop\09de\00"
define void @quikmult(i32 %0, i8 signext %1) {
switch i32 %0, label %31 [
i32 16, label %3
i32 8, label %5
i32 4, label %7
i32 2, label %9
i32 12, label %11
i32 6, label %13
i32 9, label %15
i32 3, label %17
i32 15, label %19
i32 5, label %21
i32 10, label %23
i32 14, label %26
i32 7, label %28
]
3: ; preds = %2
%4 = tail call i32 (...) @doublereg()
br label %5
5: ; preds = %2, %3
%6 = tail call i32 (...) @doublereg()
br label %7
7: ; preds = %2, %5
%8 = tail call i32 (...) @doublereg()
br label %9
9: ; preds = %2, %7
%10 = tail call i32 (...) @doublereg()
br label %41
11: ; preds = %2
%12 = tail call i32 (...) @doublereg()
br label %13
13: ; preds = %2, %11
%14 = tail call i32 (...) @sixreg()
br label %41
15: ; preds = %2
%16 = tail call i32 (...) @threereg()
br label %17
17: ; preds = %2, %15
%18 = tail call i32 (...) @threereg()
br label %41
19: ; preds = %2
%20 = tail call i32 (...) @threereg()
br label %21
21: ; preds = %2, %19
%22 = tail call i32 (...) @fivereg()
br label %41
23: ; preds = %2
%24 = tail call i32 (...) @fivereg()
%25 = tail call i32 (...) @doublereg()
br label %41
26: ; preds = %2
%27 = tail call i32 (...) @doublereg()
br label %28
28: ; preds = %2, %26
%29 = tail call i32 (...) @sixreg()
%30 = tail call i32 (...) @addbc()
br label %41
31: ; preds = %2
%32 = icmp eq i8 %1, 0
br i1 %32, label %38, label %33
33: ; preds = %31
%34 = tail call i32 @ol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%35 = tail call i32 @const2(i32 %0)
%36 = tail call i32 @callrts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%37 = tail call i32 @ol(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %41
38: ; preds = %31
%39 = tail call i32 @const2(i32 %0)
%40 = tail call i32 @callrts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %38, %33, %28, %23, %21, %17, %13, %9
ret void
}