#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*/ panel_utils_get_blank_str(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
void panel_utils_channel_str(char *tempstr, int port, int channel) {
  switch (port) {
  case 7:
  case 0:
  case 1:
  case 9:
  case 4:
  case 8:
  case 3:
    sprintf(tempstr, "CH %d", (channel + 1));
    break;
  case 2:
    switch (channel) {
    case 0:
      sprintf(tempstr, "CV A");
      break;
    case 1:
      sprintf(tempstr, "CV B");
      break;
    case 2:
      sprintf(tempstr, "CV C");
      break;
    case 3:
      sprintf(tempstr, "CV D");
      break;
    default:
      panel_utils_get_blank_str(tempstr);
      break;
    }
    break;
  default:
    panel_utils_get_blank_str(tempstr);
    break;
  }
}


x86 assembly (clang, -O0):
<panel_utils_channel_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2,%eax
jb     117f <panel_utils_channel_str+0x5f>
jmp    1146 <panel_utils_channel_str+0x26>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     119c <panel_utils_channel_str+0x7c>
jmp    1157 <panel_utils_channel_str+0x37>
mov    -0x14(%rbp),%eax
add    $0xfffffffd,%eax
sub    $0x2,%eax
jb     117f <panel_utils_channel_str+0x5f>
jmp    116b <panel_utils_channel_str+0x4b>
mov    -0x14(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x2,%eax
ja     122b <panel_utils_channel_str+0x10b>
jmp    117f <panel_utils_channel_str+0x5f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1234 <panel_utils_channel_str+0x114>
mov    -0x10(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x3,%rax
ja     121d <panel_utils_channel_str+0xfd>
mov    -0x20(%rbp),%rax
lea    0xe48(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1226 <panel_utils_channel_str+0x106>
mov    -0x8(%rbp),%rdi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1226 <panel_utils_channel_str+0x106>
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1226 <panel_utils_channel_str+0x106>
mov    -0x8(%rbp),%rdi
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1226 <panel_utils_channel_str+0x106>
mov    -0x8(%rbp),%rdi
call   1040 <panel_utils_get_blank_str@plt>
jmp    1234 <panel_utils_channel_str+0x114>
mov    -0x8(%rbp),%rdi
call   1040 <panel_utils_get_blank_str@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panel_utils_channel_str>:
cmp    $0x9,%esi
ja     1167 <panel_utils_channel_str+0x47>
mov    $0x39b,%eax
bt     %esi,%eax
jae    1140 <panel_utils_channel_str+0x20>
add    $0x1,%edx
lea    0xed7(%rip),%rsi
xor    %eax,%eax
jmp    1030 <sprintf@plt>
cmp    $0x2,%esi
jne    1167 <panel_utils_channel_str+0x47>
cmp    $0x3,%edx
ja     1167 <panel_utils_channel_str+0x47>
mov    %edx,%eax
lea    0xead(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x0,0x4(%rdi)
movl   $0x41205643,(%rdi)
ret
jmp    1040 <panel_utils_get_blank_str@plt>
movb   $0x0,0x4(%rdi)
movl   $0x42205643,(%rdi)
ret
movb   $0x0,0x4(%rdi)
movl   $0x43205643,(%rdi)
ret
movb   $0x0,0x4(%rdi)
movl   $0x44205643,(%rdi)
ret

LLVM IR (-O0):
@.str = [6 x i8] c"CH %d\00"
@.str.1 = [5 x i8] c"CV A\00"
@.str.2 = [5 x i8] c"CV B\00"
@.str.3 = [5 x i8] c"CV C\00"
@.str.4 = [5 x i8] c"CV D\00"
define void @panel_utils_channel_str(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
switch i32 %7, label %31 [
i32 7, label %8
i32 0, label %8
i32 1, label %8
i32 9, label %8
i32 4, label %8
i32 8, label %8
i32 3, label %8
i32 2, label %13
]
8: ; preds = %3, %3, %3, %3, %3, %3, %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 1
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %34
13: ; preds = %3
%14 = load i32, i32* %6
switch i32 %14, label %27 [
i32 0, label %15
i32 1, label %18
i32 2, label %21
i32 3, label %24
]
15: ; preds = %13
%16 = load i8*, i8** %4
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %30
18: ; preds = %13
%19 = load i8*, i8** %4
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %30
21: ; preds = %13
%22 = load i8*, i8** %4
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %30
24: ; preds = %13
%25 = load i8*, i8** %4
%26 = call i32 (i8*, i8*, ...) @sprintf(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %30
27: ; preds = %13
%28 = load i8*, i8** %4
%29 = call i32 @panel_utils_get_blank_str(i8* %28)
br label %30
30: ; preds = %27, %24, %21, %18, %15
br label %34
31: ; preds = %3
%32 = load i8*, i8** %4
%33 = call i32 @panel_utils_get_blank_str(i8* %32)
br label %34
34: ; preds = %31, %30, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"CH %d\00"
@.str.1 = [5 x i8] c"CV A\00"
@.str.2 = [5 x i8] c"CV B\00"
@.str.3 = [5 x i8] c"CV C\00"
@.str.4 = [5 x i8] c"CV D\00"
define void @panel_utils_channel_str(i8* %0, i32 %1, i32 %2) {
switch i32 %1, label %14 [
i32 7, label %4
i32 0, label %4
i32 1, label %4
i32 9, label %4
i32 4, label %4
i32 8, label %4
i32 3, label %4
i32 2, label %7
]
4: ; preds = %3, %3, %3, %3, %3, %3, %3
%5 = add nsw i32 %2, 1
%6 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %16
7: ; preds = %3
switch i32 %2, label %12 [
i32 0, label %8
i32 1, label %9
i32 2, label %10
i32 3, label %11
]
8: ; preds = %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %0, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 5, i1 false)
br label %16
9: ; preds = %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %0, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 5, i1 false)
br label %16
10: ; preds = %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %0, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 5, i1 false)
br label %16
11: ; preds = %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %0, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 5, i1 false)
br label %16
12: ; preds = %7
%13 = tail call i32 @panel_utils_get_blank_str(i8* %0)
br label %16
14: ; preds = %3
%15 = tail call i32 @panel_utils_get_blank_str(i8* %0)
br label %16
16: ; preds = %8, %9, %10, %11, %12, %14, %4
ret void
}