#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 decode_modality(int si_modality, char *string) {
  switch (si_modality) {
  case 0:
    sprintf(string, "CRCOPEN_LISTEN");
    break;
  case 4:
    sprintf(string, "CRCOPEN_POS_ABSOLUTE");
    break;
  case 5:
    sprintf(string, "CRCOPEN_POS_RELATIVE");
    break;
  case 7:
    sprintf(string, "CRCOPEN_POS_ADDITIVE");
    break;
  case 17:
    sprintf(string, "CRCOPEN_POS_ADDITIVE_SB");
    break;
  case 170:
    sprintf(string, "CRCOPEN_POS_ADDITIVE_SBE");
    break;
  default:
    sprintf(string, "--");
    break;
  }
}


x86 assembly (clang, -O0):
<decode_modality>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1189 <decode_modality+0x79>
jmp    1132 <decode_modality+0x22>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     119e <decode_modality+0x8e>
jmp    1143 <decode_modality+0x33>
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
je     11b3 <decode_modality+0xa3>
jmp    1154 <decode_modality+0x44>
mov    -0x14(%rbp),%eax
sub    $0x7,%eax
je     11c8 <decode_modality+0xb8>
jmp    1165 <decode_modality+0x55>
mov    -0x14(%rbp),%eax
sub    $0x11,%eax
je     11dd <decode_modality+0xcd>
jmp    1176 <decode_modality+0x66>
mov    -0x14(%rbp),%eax
sub    $0xaa,%eax
je     11f2 <decode_modality+0xe2>
jmp    1207 <decode_modality+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1217 <decode_modality+0x107>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1217 <decode_modality+0x107>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1217 <decode_modality+0x107>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1217 <decode_modality+0x107>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1217 <decode_modality+0x107>
mov    -0x10(%rbp),%rdi
lea    0xe69(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1217 <decode_modality+0x107>
mov    -0x10(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_modality>:
cmp    $0x11,%edi
ja     1133 <decode_modality+0x33>
mov    %edi,%eax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movabs $0x4e455453494c5f,%rax
mov    %rax,0x7(%rsi)
movabs $0x5f4e45504f435243,%rax
45 4e 5f
mov    %rax,(%rsi)
ret
cmp    $0xaa,%edi
jne    1151 <decode_modality+0x51>
movups 0xf75(%rip),%xmm0
movups %xmm0,0x9(%rsi)
movups 0xf61(%rip),%xmm0
movups %xmm0,(%rsi)
ret
movb   $0x0,0x2(%rsi)
movw   $0x2d2d,(%rsi)
ret
movups 0xef5(%rip),%xmm0
movups %xmm0,(%rsi)
movabs $0x4554554c4f5342,%rax
mov    %rax,0xd(%rsi)
ret
movups 0xef1(%rip),%xmm0
movups %xmm0,(%rsi)
movabs $0x45564954414c45,%rax
mov    %rax,0xd(%rsi)
ret
movups 0xeed(%rip),%xmm0
movups %xmm0,(%rsi)
movabs $0x45564954494444,%rax
mov    %rax,0xd(%rsi)
ret
movups 0xee9(%rip),%xmm0
movups %xmm0,(%rsi)
movabs $0x42535f45564954,%rax
mov    %rax,0x10(%rsi)
ret

LLVM IR (-O0):
@.str = [15 x i8] c"CRCOPEN_LISTEN\00"
@.str.1 = [21 x i8] c"CRCOPEN_POS_ABSOLUTE\00"
@.str.2 = [21 x i8] c"CRCOPEN_POS_RELATIVE\00"
@.str.3 = [21 x i8] c"CRCOPEN_POS_ADDITIVE\00"
@.str.4 = [24 x i8] c"CRCOPEN_POS_ADDITIVE_SB\00"
@.str.5 = [25 x i8] c"CRCOPEN_POS_ADDITIVE_SBE\00"
@.str.6 = [3 x i8] c"--\00"
define void @decode_modality(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %24 [
i32 0, label %6
i32 4, label %9
i32 5, label %12
i32 7, label %15
i32 17, label %18
i32 170, label %21
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %27
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %27
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %27
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %27
18: ; preds = %2
%19 = load i8*, i8** %4
%20 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %27
21: ; preds = %2
%22 = load i8*, i8** %4
%23 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %27
24: ; preds = %2
%25 = load i8*, i8** %4
%26 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %27
27: ; preds = %24, %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"CRCOPEN_LISTEN\00"
@.str.1 = [21 x i8] c"CRCOPEN_POS_ABSOLUTE\00"
@.str.2 = [21 x i8] c"CRCOPEN_POS_RELATIVE\00"
@.str.3 = [21 x i8] c"CRCOPEN_POS_ADDITIVE\00"
@.str.4 = [24 x i8] c"CRCOPEN_POS_ADDITIVE_SB\00"
@.str.5 = [25 x i8] c"CRCOPEN_POS_ADDITIVE_SBE\00"
@.str.6 = [3 x i8] c"--\00"
define void @decode_modality(i32 %0, i8* nocapture writeonly %1) {
switch i32 %0, label %9 [
i32 0, label %3
i32 4, label %4
i32 5, label %5
i32 7, label %6
i32 17, label %7
i32 170, label %8
]
3: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(15) %1, i8* align 1 dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 15, i1 false)
br label %10
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(21) %1, i8* align 1 dereferenceable(21) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 21, i1 false)
br label %10
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(21) %1, i8* align 1 dereferenceable(21) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i64 21, i1 false)
br label %10
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(21) %1, i8* align 1 dereferenceable(21) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i64 21, i1 false)
br label %10
7: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(24) %1, i8* align 1 dereferenceable(24) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 24, i1 false)
br label %10
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(25) %1, i8* align 1 dereferenceable(25) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i64 25, i1 false)
br label %10
9: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %1, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 3, i1 false)
br label %10
10: ; preds = %9, %8, %7, %6, %5, %4, %3
ret void
}