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


x86 assembly (clang, -O0):
<scale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
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     118a <scale+0x5a>
jmp    1168 <scale+0x38>
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
je     11b0 <scale+0x80>
jmp    1179 <scale+0x49>
mov    -0x2c(%rbp),%eax
sub    $0x4,%eax
je     11d6 <scale+0xa6>
jmp    11f7 <scale+0xc7>
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),%eax
mov    %eax,(%rsp)
call   1030 <scale2x@plt>
jmp    11f7 <scale+0xc7>
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),%eax
mov    %eax,(%rsp)
call   1050 <scale3x@plt>
jmp    11f7 <scale+0xc7>
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),%eax
mov    %eax,(%rsp)
call   1040 <scale4x@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale>:
push   %rax
mov    0x18(%rsp),%eax
mov    0x10(%rsp),%r10d
cmp    $0x4,%edi
je     1164 <scale+0x34>
cmp    $0x3,%edi
je     117f <scale+0x4f>
cmp    $0x2,%edi
jne    117d <scale+0x4d>
mov    %eax,(%rsp)
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %r10d,%r9d
call   1030 <scale2x@plt>
pop    %rax
ret
mov    %eax,(%rsp)
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %r10d,%r9d
call   1040 <scale4x@plt>
pop    %rax
ret
mov    %eax,(%rsp)
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %r10d,%r9d
call   1050 <scale3x@plt>
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) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i32, i32* %9
switch i32 %17, label %45 [
i32 2, label %18
i32 3, label %27
i32 4, label %36
]
18: ; preds = %8
%19 = load i8*, i8** %10
%20 = load i32, i32* %11
%21 = load i8*, i8** %12
%22 = load i32, i32* %13
%23 = load i32, i32* %14
%24 = load i32, i32* %15
%25 = load i32, i32* %16
%26 = call i32 @scale2x(i8* %19, i32 %20, i8* %21, i32 %22, i32 %23, i32 %24, i32 %25)
br label %45
27: ; preds = %8
%28 = load i8*, i8** %10
%29 = load i32, i32* %11
%30 = load i8*, i8** %12
%31 = load i32, i32* %13
%32 = load i32, i32* %14
%33 = load i32, i32* %15
%34 = load i32, i32* %16
%35 = call i32 @scale3x(i8* %28, i32 %29, i8* %30, i32 %31, i32 %32, i32 %33, i32 %34)
br label %45
36: ; preds = %8
%37 = load i8*, i8** %10
%38 = load i32, i32* %11
%39 = load i8*, i8** %12
%40 = load i32, i32* %13
%41 = load i32, i32* %14
%42 = load i32, i32* %15
%43 = load i32, i32* %16
%44 = call i32 @scale4x(i8* %37, i32 %38, i8* %39, i32 %40, i32 %41, i32 %42, i32 %43)
br label %45
45: ; preds = %8, %36, %27, %18
ret void
}

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