#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*/ scale3x_16_def(void *, void *, void *, void const *,
                                  void const *, void const *, unsigned int);
int /*<<< orphan*/ scale3x_32_def(void *, void *, void *, void const *,
                                  void const *, void const *, unsigned int);
int /*<<< orphan*/ scale3x_8_def(void *, void *, void *, void const *,
                                 void const *, void const *, unsigned int);
void stage_scale3x(void *dst0, void *dst1, void *dst2, const void *src0,
                   const void *src1, const void *src2, unsigned pixel,
                   unsigned pixel_per_row) {
  switch (pixel) {
  case 1:
    scale3x_8_def(dst0, dst1, dst2, src0, src1, src2, pixel_per_row);
    break;
  case 2:
    scale3x_16_def(dst0, dst1, dst2, src0, src1, src2, pixel_per_row);
    break;
  case 4:
    scale3x_32_def(dst0, dst1, dst2, src0, src1, src2, pixel_per_row);
    break;
  }
}


x86 assembly (clang, -O0):
<stage_scale3x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x1,%eax
je     118c <stage_scale3x+0x5c>
jmp    116a <stage_scale3x+0x3a>
mov    -0x34(%rbp),%eax
sub    $0x2,%eax
je     11b4 <stage_scale3x+0x84>
jmp    117b <stage_scale3x+0x4b>
mov    -0x34(%rbp),%eax
sub    $0x4,%eax
je     11dc <stage_scale3x+0xac>
jmp    11ff <stage_scale3x+0xcf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <scale3x_8_def@plt>
jmp    11ff <stage_scale3x+0xcf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <scale3x_16_def@plt>
jmp    11ff <stage_scale3x+0xcf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <scale3x_32_def@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stage_scale3x>:
push   %rax
mov    0x18(%rsp),%r10d
mov    0x10(%rsp),%eax
cmp    $0x4,%eax
je     1154 <stage_scale3x+0x24>
cmp    $0x2,%eax
je     115f <stage_scale3x+0x2f>
cmp    $0x1,%eax
jne    115d <stage_scale3x+0x2d>
mov    %r10d,(%rsp)
call   1050 <scale3x_8_def@plt>
pop    %rax
ret
mov    %r10d,(%rsp)
call   1030 <scale3x_32_def@plt>
pop    %rax
ret
mov    %r10d,(%rsp)
call   1040 <scale3x_16_def@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @stage_scale3x(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i32 %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i32, i32* %15
switch i32 %17, label %45 [
i32 1, label %18
i32 2, label %27
i32 4, label %36
]
18: ; preds = %8
%19 = load i8*, i8** %9
%20 = load i8*, i8** %10
%21 = load i8*, i8** %11
%22 = load i8*, i8** %12
%23 = load i8*, i8** %13
%24 = load i8*, i8** %14
%25 = load i32, i32* %16
%26 = call i32 @scale3x_8_def(i8* %19, i8* %20, i8* %21, i8* %22, i8* %23, i8* %24, i32 %25)
br label %45
27: ; preds = %8
%28 = load i8*, i8** %9
%29 = load i8*, i8** %10
%30 = load i8*, i8** %11
%31 = load i8*, i8** %12
%32 = load i8*, i8** %13
%33 = load i8*, i8** %14
%34 = load i32, i32* %16
%35 = call i32 @scale3x_16_def(i8* %28, i8* %29, i8* %30, i8* %31, i8* %32, i8* %33, i32 %34)
br label %45
36: ; preds = %8
%37 = load i8*, i8** %9
%38 = load i8*, i8** %10
%39 = load i8*, i8** %11
%40 = load i8*, i8** %12
%41 = load i8*, i8** %13
%42 = load i8*, i8** %14
%43 = load i32, i32* %16
%44 = call i32 @scale3x_32_def(i8* %37, i8* %38, i8* %39, i8* %40, i8* %41, i8* %42, i32 %43)
br label %45
45: ; preds = %8, %36, %27, %18
ret void
}

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