#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*/ sprintf(char *, char *, ...);
void panel_utils_cvgate_pair_mode_to_str(char *tempstr, int mode) {
  if (mode == (-2)) {
    sprintf(tempstr, "VELOCITY");
  } else if (mode == (-1)) {
    sprintf(tempstr, "NOTE");
  } else if (mode >= 0) {
    sprintf(tempstr, "CC %d", mode);
  } else {
    sprintf(tempstr, "NONE");
  }
}


x86 assembly (clang, -O0):
<panel_utils_cvgate_pair_mode_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xfffffffe,-0xc(%rbp)
jne    1140 <panel_utils_cvgate_pair_mode_to_str+0x30>
mov    -0x8(%rbp),%rdi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11a1 <panel_utils_cvgate_pair_mode_to_str+0x91>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1161 <panel_utils_cvgate_pair_mode_to_str+0x51>
mov    -0x8(%rbp),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    119c <panel_utils_cvgate_pair_mode_to_str+0x8c>
cmpl   $0x0,-0xc(%rbp)
jl     1185 <panel_utils_cvgate_pair_mode_to_str+0x75>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1197 <panel_utils_cvgate_pair_mode_to_str+0x87>
mov    -0x8(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    119c <panel_utils_cvgate_pair_mode_to_str+0x8c>
jmp    11a1 <panel_utils_cvgate_pair_mode_to_str+0x91>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panel_utils_cvgate_pair_mode_to_str>:
cmp    $0xffffffff,%esi
je     112e <panel_utils_cvgate_pair_mode_to_str+0x1e>
mov    %esi,%edx
cmp    $0xfffffffe,%esi
jne    1139 <panel_utils_cvgate_pair_mode_to_str+0x29>
movabs $0x595449434f4c4556,%rax
49 54 59
mov    %rax,(%rdi)
movb   $0x0,0x8(%rdi)
ret
movb   $0x0,0x4(%rdi)
movl   $0x45544f4e,(%rdi)
ret
test   %edx,%edx
js     114b <panel_utils_cvgate_pair_mode_to_str+0x3b>
lea    0xeca(%rip),%rsi
xor    %eax,%eax
jmp    1030 <sprintf@plt>
movb   $0x0,0x4(%rdi)
movl   $0x454e4f4e,(%rdi)
ret

LLVM IR (-O0):
@.str = [9 x i8] c"VELOCITY\00"
@.str.1 = [5 x i8] c"NOTE\00"
@.str.2 = [6 x i8] c"CC %d\00"
@.str.3 = [5 x i8] c"NONE\00"
define void @panel_utils_cvgate_pair_mode_to_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
%6 = icmp eq i32 %5, -2
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %28
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %27
16: ; preds = %10
%17 = load i32, i32* %4
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = call i32 (i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %26
23: ; preds = %16
%24 = load i8*, i8** %3
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %23, %19
br label %27
27: ; preds = %26, %13
br label %28
28: ; preds = %27, %7
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"VELOCITY\00"
@.str.1 = [5 x i8] c"NOTE\00"
@.str.2 = [6 x i8] c"CC %d\00"
@.str.3 = [5 x i8] c"NONE\00"
define void @panel_utils_cvgate_pair_mode_to_str(i8* nocapture writeonly %0, i32 %1) {
switch i32 %1, label %5 [
i32 -2, label %3
i32 -1, label %4
]
3: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %0, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 9, i1 false)
br label %10
4: ; preds = %2
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 %10
5: ; preds = %2
%6 = icmp sgt i32 %1, -1
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %10
9: ; preds = %5
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 %10
10: ; preds = %4, %9, %7, %3
ret void
}