#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*/ scale2x(void *, unsigned int, void const *, unsigned int,
                           unsigned int, unsigned int, unsigned int,
                           unsigned int);
int /*<<< orphan*/ scale2x3(void *, unsigned int, void const *, unsigned int,
                            unsigned int, unsigned int, unsigned int,
                            unsigned int);
int /*<<< orphan*/ scale2x4(void *, unsigned int, void const *, unsigned int,
                            unsigned int, unsigned int, unsigned int,
                            unsigned int);
int /*<<< orphan*/ scale3x(void *, unsigned int, void const *, unsigned int,
                           unsigned int, unsigned int, unsigned int,
                           unsigned int);
int /*<<< orphan*/ scale4x(void *, unsigned int, void const *, unsigned int,
                           unsigned int, unsigned int, unsigned int,
                           unsigned int);
void scale(unsigned scale, void *void_dst, unsigned dst_slice,
           const void *void_src, unsigned src_slice, unsigned pixel,
           unsigned width, unsigned height, unsigned opt) {
  switch (scale) {
  case 202:
  case 2:
    scale2x(void_dst, dst_slice, void_src, src_slice, pixel, width, height,
            opt);
    break;
  case 203:
    scale2x3(void_dst, dst_slice, void_src, src_slice, pixel, width, height,
             opt);
    break;
  case 204:
    scale2x4(void_dst, dst_slice, void_src, src_slice, pixel, width, height,
             opt);
    break;
  case 303:
  case 3:
    scale3x(void_dst, dst_slice, void_src, src_slice, pixel, width, height,
            opt);
    break;
  case 404:
  case 4:
    scale4x(void_dst, dst_slice, void_src, src_slice, pixel, width, height,
            opt);
    break;
  }
}


x86 assembly (clang, -O0):
<scale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x2,%eax
je     120c <scale+0xbc>
jmp    118b <scale+0x3b>
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
je     1299 <scale+0x149>
jmp    119c <scale+0x4c>
mov    -0x2c(%rbp),%eax
sub    $0x4,%eax
je     12c8 <scale+0x178>
jmp    11ad <scale+0x5d>
mov    -0x2c(%rbp),%eax
sub    $0xca,%eax
je     120c <scale+0xbc>
jmp    11c0 <scale+0x70>
mov    -0x2c(%rbp),%eax
sub    $0xcb,%eax
je     123b <scale+0xeb>
jmp    11d3 <scale+0x83>
mov    -0x2c(%rbp),%eax
sub    $0xcc,%eax
je     126a <scale+0x11a>
jmp    11e6 <scale+0x96>
mov    -0x2c(%rbp),%eax
sub    $0x12f,%eax
je     1299 <scale+0x149>
jmp    11f9 <scale+0xa9>
mov    -0x2c(%rbp),%eax
sub    $0x194,%eax
je     12c8 <scale+0x178>
jmp    12f2 <scale+0x1a2>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <scale2x@plt>
jmp    12f2 <scale+0x1a2>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1070 <scale2x3@plt>
jmp    12f2 <scale+0x1a2>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <scale2x4@plt>
jmp    12f2 <scale+0x1a2>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <scale3x@plt>
jmp    12f2 <scale+0x1a2>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <scale4x@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale>:
push   %rax
mov    0x20(%rsp),%r11d
mov    0x18(%rsp),%r10d
mov    0x10(%rsp),%eax
cmp    $0xca,%edi
jg     117f <scale+0x2f>
cmp    $0x3,%edi
jg     11be <scale+0x6e>
cmp    $0x2,%edi
je     11cf <scale+0x7f>
cmp    $0x3,%edi
je     1217 <scale+0xc7>
jmp    1251 <scale+0x101>
cmp    $0x12e,%edi
jg     11eb <scale+0x9b>
cmp    $0xcb,%edi
je     1233 <scale+0xe3>
cmp    $0xcc,%edi
jne    1251 <scale+0x101>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r11
push   %r10
call   1040 <scale2x4@plt>
jmp    124d <scale+0xfd>
cmp    $0x4,%edi
je     11fb <scale+0xab>
cmp    $0xca,%edi
jne    1251 <scale+0x101>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r11
push   %r10
call   1030 <scale2x@plt>
jmp    124d <scale+0xfd>
cmp    $0x12f,%edi
je     1217 <scale+0xc7>
cmp    $0x194,%edi
jne    1251 <scale+0x101>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r11
push   %r10
call   1050 <scale4x@plt>
jmp    124d <scale+0xfd>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r11
push   %r10
call   1060 <scale3x@plt>
jmp    124d <scale+0xfd>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r11
push   %r10
call   1070 <scale2x3@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @scale(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i8* %3, i8** %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%19 = load i32, i32* %10
switch i32 %19, label %70 [
i32 202, label %20
i32 2, label %20
i32 203, label %30
i32 204, label %40
i32 303, label %50
i32 3, label %50
i32 404, label %60
i32 4, label %60
]
20: ; preds = %9, %9
%21 = load i8*, i8** %11
%22 = load i32, i32* %12
%23 = load i8*, i8** %13
%24 = load i32, i32* %14
%25 = load i32, i32* %15
%26 = load i32, i32* %16
%27 = load i32, i32* %17
%28 = load i32, i32* %18
%29 = call i32 @scale2x(i8* %21, i32 %22, i8* %23, i32 %24, i32 %25, i32 %26, i32 %27, i32 %28)
br label %70
30: ; preds = %9
%31 = load i8*, i8** %11
%32 = load i32, i32* %12
%33 = load i8*, i8** %13
%34 = load i32, i32* %14
%35 = load i32, i32* %15
%36 = load i32, i32* %16
%37 = load i32, i32* %17
%38 = load i32, i32* %18
%39 = call i32 @scale2x3(i8* %31, i32 %32, i8* %33, i32 %34, i32 %35, i32 %36, i32 %37, i32 %38)
br label %70
40: ; preds = %9
%41 = load i8*, i8** %11
%42 = load i32, i32* %12
%43 = load i8*, i8** %13
%44 = load i32, i32* %14
%45 = load i32, i32* %15
%46 = load i32, i32* %16
%47 = load i32, i32* %17
%48 = load i32, i32* %18
%49 = call i32 @scale2x4(i8* %41, i32 %42, i8* %43, i32 %44, i32 %45, i32 %46, i32 %47, i32 %48)
br label %70
50: ; preds = %9, %9
%51 = load i8*, i8** %11
%52 = load i32, i32* %12
%53 = load i8*, i8** %13
%54 = load i32, i32* %14
%55 = load i32, i32* %15
%56 = load i32, i32* %16
%57 = load i32, i32* %17
%58 = load i32, i32* %18
%59 = call i32 @scale3x(i8* %51, i32 %52, i8* %53, i32 %54, i32 %55, i32 %56, i32 %57, i32 %58)
br label %70
60: ; preds = %9, %9
%61 = load i8*, i8** %11
%62 = load i32, i32* %12
%63 = load i8*, i8** %13
%64 = load i32, i32* %14
%65 = load i32, i32* %15
%66 = load i32, i32* %16
%67 = load i32, i32* %17
%68 = load i32, i32* %18
%69 = call i32 @scale4x(i8* %61, i32 %62, i8* %63, i32 %64, i32 %65, i32 %66, i32 %67, i32 %68)
br label %70
70: ; preds = %9, %60, %50, %40, %30, %20
ret void
}

LLVM IR (-O2):
define void @scale(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
switch i32 %0, label %20 [
i32 202, label %10
i32 2, label %10
i32 203, label %12
i32 204, label %14
i32 303, label %16
i32 3, label %16
i32 404, label %18
i32 4, label %18
]
10: ; preds = %9, %9
%11 = tail call i32 @scale2x(i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
br label %20
12: ; preds = %9
%13 = tail call i32 @scale2x3(i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
br label %20
14: ; preds = %9
%15 = tail call i32 @scale2x4(i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
br label %20
16: ; preds = %9, %9
%17 = tail call i32 @scale3x(i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
br label %20
18: ; preds = %9, %9
%19 = tail call i32 @scale4x(i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
br label %20
20: ; preds = %9, %18, %16, %14, %12, %10
ret void
}