#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*/ c_bilinear_resample_channel_float(int, int, void *, int, int,
                                                     int, int, int, void *, int,
                                                     int, int);
int /*<<< orphan*/ c_bilinear_resample_channel_word16(int, int, void *, int,
                                                      int, int, int, int,
                                                      void *, int, int, int);
int /*<<< orphan*/ c_bilinear_resample_channel_word32(int, int, void *, int,
                                                      int, int, int, int,
                                                      void *, int, int, int);
int /*<<< orphan*/ c_bilinear_resample_channel_word8(int, int, void *, int, int,
                                                     int, int, int, void *, int,
                                                     int, int);
void c_bilinear_resample_channel(int k_type, int width1, int height1, void *p1,
                                 int nchn1, int pad1, int ofs1, int width2,
                                 int height2, void *p2, int nchn2, int pad2,
                                 int ofs2) {
  switch (k_type) {
  case 1:
    c_bilinear_resample_channel_word8(width1, height1, p1, nchn1, pad1, ofs1,
                                      width2, height2, p2, nchn2, pad2, ofs2);
    ;
    break;
  case 2:
    c_bilinear_resample_channel_word16(width1, height1, p1, nchn1, pad1, ofs1,
                                       width2, height2, p2, nchn2, pad2, ofs2);
    ;
    break;
  case 3:
    c_bilinear_resample_channel_word32(width1, height1, p1, nchn1, pad1, ofs1,
                                       width2, height2, p2, nchn2, pad2, ofs2);
    ;
    break;
  case 4:
    c_bilinear_resample_channel_float(width1, height1, p1, nchn1, pad1, ofs1,
                                      width2, height2, p2, nchn2, pad2, ofs2);
    ;
    break;
  }
}


x86 assembly (clang, -O0):
<c_bilinear_resample_channel>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9d,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x3,%eax
ja     12e4 <c_bilinear_resample_channel+0x1a4>
mov    -0x40(%rbp),%rax
lea    0xe68(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x40(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1050 <c_bilinear_resample_channel_word8@plt>
jmp    12e4 <c_bilinear_resample_channel+0x1a4>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x40(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1060 <c_bilinear_resample_channel_word16@plt>
jmp    12e4 <c_bilinear_resample_channel+0x1a4>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x40(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1040 <c_bilinear_resample_channel_word32@plt>
jmp    12e4 <c_bilinear_resample_channel+0x1a4>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    0x28(%rbp),%rbx
mov    0x30(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x40(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1030 <c_bilinear_resample_channel_float@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_bilinear_resample_channel>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     1215 <c_bilinear_resample_channel+0xd5>
mov    0x60(%rsp),%r13d
mov    0x58(%rsp),%r12d
mov    0x50(%rsp),%r15d
mov    0x48(%rsp),%r14
mov    0x40(%rsp),%r11d
mov    0x38(%rsp),%r10d
mov    0x30(%rsp),%eax
lea    0xe82(%rip),%rbx
movslq (%rbx,%rdi,4),%rdi
add    %rbx,%rdi
jmp    *%rdi
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r13
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
call   1050 <c_bilinear_resample_channel_word8@plt>
jmp    1211 <c_bilinear_resample_channel+0xd1>
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r13
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
call   1060 <c_bilinear_resample_channel_word16@plt>
jmp    1211 <c_bilinear_resample_channel+0xd1>
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r13
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
call   1040 <c_bilinear_resample_channel_word32@plt>
jmp    1211 <c_bilinear_resample_channel+0xd1>
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %r13
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
call   1030 <c_bilinear_resample_channel_float@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @c_bilinear_resample_channel(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i8* %9, i32 %10, i32 %11, i32 %12) {
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32 %0, i32* %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store i8* %3, i8** %17
store i32 %4, i32* %18
store i32 %5, i32* %19
store i32 %6, i32* %20
store i32 %7, i32* %21
store i32 %8, i32* %22
store i8* %9, i8** %23
store i32 %10, i32* %24
store i32 %11, i32* %25
store i32 %12, i32* %26
%27 = load i32, i32* %14
switch i32 %27, label %84 [
i32 1, label %28
i32 2, label %42
i32 3, label %56
i32 4, label %70
]
28: ; preds = %13
%29 = load i32, i32* %15
%30 = load i32, i32* %16
%31 = load i8*, i8** %17
%32 = load i32, i32* %18
%33 = load i32, i32* %19
%34 = load i32, i32* %20
%35 = load i32, i32* %21
%36 = load i32, i32* %22
%37 = load i8*, i8** %23
%38 = load i32, i32* %24
%39 = load i32, i32* %25
%40 = load i32, i32* %26
%41 = call i32 @c_bilinear_resample_channel_word8(i32 %29, i32 %30, i8* %31, i32 %32, i32 %33, i32 %34, i32 %35, i32 %36, i8* %37, i32 %38, i32 %39, i32 %40)
br label %84
42: ; preds = %13
%43 = load i32, i32* %15
%44 = load i32, i32* %16
%45 = load i8*, i8** %17
%46 = load i32, i32* %18
%47 = load i32, i32* %19
%48 = load i32, i32* %20
%49 = load i32, i32* %21
%50 = load i32, i32* %22
%51 = load i8*, i8** %23
%52 = load i32, i32* %24
%53 = load i32, i32* %25
%54 = load i32, i32* %26
%55 = call i32 @c_bilinear_resample_channel_word16(i32 %43, i32 %44, i8* %45, i32 %46, i32 %47, i32 %48, i32 %49, i32 %50, i8* %51, i32 %52, i32 %53, i32 %54)
br label %84
56: ; preds = %13
%57 = load i32, i32* %15
%58 = load i32, i32* %16
%59 = load i8*, i8** %17
%60 = load i32, i32* %18
%61 = load i32, i32* %19
%62 = load i32, i32* %20
%63 = load i32, i32* %21
%64 = load i32, i32* %22
%65 = load i8*, i8** %23
%66 = load i32, i32* %24
%67 = load i32, i32* %25
%68 = load i32, i32* %26
%69 = call i32 @c_bilinear_resample_channel_word32(i32 %57, i32 %58, i8* %59, i32 %60, i32 %61, i32 %62, i32 %63, i32 %64, i8* %65, i32 %66, i32 %67, i32 %68)
br label %84
70: ; preds = %13
%71 = load i32, i32* %15
%72 = load i32, i32* %16
%73 = load i8*, i8** %17
%74 = load i32, i32* %18
%75 = load i32, i32* %19
%76 = load i32, i32* %20
%77 = load i32, i32* %21
%78 = load i32, i32* %22
%79 = load i8*, i8** %23
%80 = load i32, i32* %24
%81 = load i32, i32* %25
%82 = load i32, i32* %26
%83 = call i32 @c_bilinear_resample_channel_float(i32 %71, i32 %72, i8* %73, i32 %74, i32 %75, i32 %76, i32 %77, i32 %78, i8* %79, i32 %80, i32 %81, i32 %82)
br label %84
84: ; preds = %13, %70, %56, %42, %28
ret void
}

LLVM IR (-O2):
define void @c_bilinear_resample_channel(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i8* %9, i32 %10, i32 %11, i32 %12) {
switch i32 %0, label %22 [
i32 1, label %14
i32 2, label %16
i32 3, label %18
i32 4, label %20
]
14: ; preds = %13
%15 = tail call i32 @c_bilinear_resample_channel_word8(i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i8* %9, i32 %10, i32 %11, i32 %12)
br label %22
16: ; preds = %13
%17 = tail call i32 @c_bilinear_resample_channel_word16(i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i8* %9, i32 %10, i32 %11, i32 %12)
br label %22
18: ; preds = %13
%19 = tail call i32 @c_bilinear_resample_channel_word32(i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i8* %9, i32 %10, i32 %11, i32 %12)
br label %22
20: ; preds = %13
%21 = tail call i32 @c_bilinear_resample_channel_float(i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i8* %9, i32 %10, i32 %11, i32 %12)
br label %22
22: ; preds = %13, %20, %18, %16, %14
ret void
}