#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_port_str(char *tempstr, int port) {
  switch (port) {
  case 7:
  case 0:
    sprintf(tempstr, "MIDI DIN1");
    break;
  case 1:
    sprintf(tempstr, "MIDI DIN2");
    break;
  case 9:
  case 4:
    sprintf(tempstr, "MIDI USB DEV");
    break;
  case 2:
    sprintf(tempstr, "CV/GATE");
    break;
  case 8:
  case 3:
    sprintf(tempstr, "MIDI USB HOST");
    break;
  default:
    panel_utils_get_blank_str(tempstr);
    break;
  }
}


x86 assembly (clang, -O0):
<panel_utils_port_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x9,%rax
ja     11bd <panel_utils_port_str+0x9d>
mov    -0x18(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11c6 <panel_utils_port_str+0xa6>
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11c6 <panel_utils_port_str+0xa6>
mov    -0x8(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11c6 <panel_utils_port_str+0xa6>
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11c6 <panel_utils_port_str+0xa6>
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11c6 <panel_utils_port_str+0xa6>
mov    -0x8(%rbp),%rdi
call   1040 <panel_utils_get_blank_str@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panel_utils_port_str>:
cmp    $0x9,%esi
ja     117b <panel_utils_port_str+0x6b>
mov    %esi,%eax
lea    0xee2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movabs $0x4e4944204944494d,%rax
44 49 4e
mov    %rax,(%rdi)
movw   $0x31,0x8(%rdi)
ret
movabs $0x54534f48204253,%rax
mov    %rax,0x6(%rdi)
jmp    1159 <panel_utils_port_str+0x49>
movabs $0x56454420425355,%rax
mov    %rax,0x5(%rdi)
movabs $0x425355204944494d,%rax
55 53 42
mov    %rax,(%rdi)
ret
movabs $0x4e4944204944494d,%rax
44 49 4e
mov    %rax,(%rdi)
movw   $0x32,0x8(%rdi)
ret
jmp    1030 <panel_utils_get_blank_str@plt>
movabs $0x455441472f5643,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
@.str = [10 x i8] c"MIDI DIN1\00"
@.str.1 = [10 x i8] c"MIDI DIN2\00"
@.str.2 = [13 x i8] c"MIDI USB DEV\00"
@.str.3 = [8 x i8] c"CV/GATE\00"
@.str.4 = [14 x i8] c"MIDI USB HOST\00"
define void @panel_utils_port_str(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %21 [
i32 7, label %6
i32 0, label %6
i32 1, label %9
i32 9, label %12
i32 4, label %12
i32 2, label %15
i32 8, label %18
i32 3, label %18
]
6: ; preds = %2, %2
%7 = load i8*, i8** %3
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %24
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %24
12: ; preds = %2, %2
%13 = load i8*, i8** %3
%14 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %24
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %24
18: ; preds = %2, %2
%19 = load i8*, i8** %3
%20 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %24
21: ; preds = %2
%22 = load i8*, i8** %3
%23 = call i32 @panel_utils_get_blank_str(i8* %22)
br label %24
24: ; preds = %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"MIDI DIN1\00"
@.str.1 = [10 x i8] c"MIDI DIN2\00"
@.str.2 = [13 x i8] c"MIDI USB DEV\00"
@.str.4 = [14 x i8] c"MIDI USB HOST\00"
define void @panel_utils_port_str(i8* %0, i32 %1) {
switch i32 %1, label %9 [
i32 7, label %3
i32 0, label %3
i32 1, label %4
i32 9, label %5
i32 4, label %5
i32 2, label %6
i32 8, label %8
i32 3, label %8
]
3: ; preds = %2, %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %0, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 10, i1 false)
br label %11
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %0, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 10, i1 false)
br label %11
5: ; preds = %2, %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(13) %0, i8* align 1 dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 13, i1 false)
br label %11
6: ; preds = %2
%7 = bitcast i8* %0 to i64*
store i64 19514412736927299, i64* %7
br label %11
8: ; preds = %2, %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(14) %0, i8* align 1 dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 14, i1 false)
br label %11
9: ; preds = %2
%10 = tail call i32 @panel_utils_get_blank_str(i8* %0)
br label %11
11: ; preds = %9, %8, %6, %5, %4, %3
ret void
}