#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_16_def(void *, void *, void const *, void const *,
                                  void const *, unsigned int);
int /*<<< orphan*/ scale2x_32_def(void *, void *, void const *, void const *,
                                  void const *, unsigned int);
int /*<<< orphan*/ scale2x_8_def(void *, void *, void const *, void const *,
                                 void const *, unsigned int);
void stage_scale2x(void *dst0, void *dst1, const void *src0, const void *src1,
                   const void *src2, unsigned pixel, unsigned pixel_per_row) {
  switch (pixel) {
  case 1:
    scale2x_8_def(dst0, dst1, src0, src1, src2, pixel_per_row);
    break;
  case 2:
    scale2x_16_def(dst0, dst1, src0, src1, src2, pixel_per_row);
    break;
  case 4:
    scale2x_32_def(dst0, dst1, src0, src1, src2, pixel_per_row);
    break;
  }
}


x86 assembly (clang, -O0):
<stage_scale2x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
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    %r9d,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x1,%eax
je     1189 <stage_scale2x+0x59>
jmp    1167 <stage_scale2x+0x37>
mov    -0x30(%rbp),%eax
sub    $0x2,%eax
je     11ab <stage_scale2x+0x7b>
jmp    1178 <stage_scale2x+0x48>
mov    -0x30(%rbp),%eax
sub    $0x4,%eax
je     11cd <stage_scale2x+0x9d>
jmp    11ea <stage_scale2x+0xba>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9d
call   1050 <scale2x_8_def@plt>
jmp    11ea <stage_scale2x+0xba>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9d
call   1030 <scale2x_16_def@plt>
jmp    11ea <stage_scale2x+0xba>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9d
call   1040 <scale2x_32_def@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stage_scale2x>:
mov    %r9d,%eax
mov    0x8(%rsp),%r9d
cmp    $0x4,%eax
je     114c <stage_scale2x+0x1c>
cmp    $0x2,%eax
je     1151 <stage_scale2x+0x21>
cmp    $0x1,%eax
jne    1156 <stage_scale2x+0x26>
jmp    1050 <scale2x_8_def@plt>
jmp    1040 <scale2x_32_def@plt>
jmp    1030 <scale2x_16_def@plt>
ret

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

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