#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*/ strlen(char *);
int /*<<< orphan*/ strncmp(char const *, char *, int /*<<< orphan*/);
int libamg_sip_get_codec_code(const char *codec_name) {
  if (!strncmp(codec_name, "alaw", strlen("alaw")))
    return 0x100;
  else if (!strncmp(codec_name, "ulaw", strlen("ulaw")))
    return 0x80;
  else if (!strncmp(codec_name, "g723", strlen("g723")))
    return 0x40;
  else if (!strncmp(codec_name, "g726-16", strlen("g726-16")))
    return 0x20;
  else if (!strncmp(codec_name, "g726-24", strlen("g726-24")))
    return 0x10;
  else if (!strncmp(codec_name, "g726-40", strlen("g726-40")))
    return 0x4;
  else if (!strncmp(codec_name, "g726", strlen("g726")))
    return 0x8;
  else if (!strncmp(codec_name, "g729", strlen("g729")))
    return 0x2;
  else if (!strncmp(codec_name, "gsm", strlen("gsm")))
    return 0x1;
  else
    return -1;
}


x86 assembly (clang, -O0):
<libamg_sip_get_codec_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xec5(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xeb3(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1167 <libamg_sip_get_codec_code+0x47>
movl   $0x100,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe8f(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe7d(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11a2 <libamg_sip_get_codec_code+0x82>
movl   $0x80,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe59(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe47(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11dd <libamg_sip_get_codec_code+0xbd>
movl   $0x40,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe23(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xe11(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1218 <libamg_sip_get_codec_code+0xf8>
movl   $0x20,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xdf0(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%edx
lea    0xdde(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1253 <libamg_sip_get_codec_code+0x133>
movl   $0x10,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    0xdbd(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%edx
lea    0xdab(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    128e <libamg_sip_get_codec_code+0x16e>
movl   $0x4,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xd8a(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%edx
lea    0xd78(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12c9 <libamg_sip_get_codec_code+0x1a9>
movl   $0x8,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    0xd54(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%edx
lea    0xd42(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1304 <libamg_sip_get_codec_code+0x1e4>
movl   $0x2,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    0xd1e(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%edx
lea    0xd0c(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    133f <libamg_sip_get_codec_code+0x21f>
movl   $0x1,-0x4(%rbp)
jmp    1346 <libamg_sip_get_codec_code+0x226>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libamg_sip_get_codec_code>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1264 <libamg_sip_get_codec_code+0x144>
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     126b <libamg_sip_get_codec_code+0x14b>
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1272 <libamg_sip_get_codec_code+0x152>
lea    0xe75(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1279 <libamg_sip_get_codec_code+0x159>
lea    0xe59(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1280 <libamg_sip_get_codec_code+0x160>
lea    0xe3d(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1287 <libamg_sip_get_codec_code+0x167>
lea    0xe21(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     128e <libamg_sip_get_codec_code+0x16e>
lea    0xe06(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1295 <libamg_sip_get_codec_code+0x175>
lea    0xdeb(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
neg    %eax
sbb    %eax,%eax
or     $0x1,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x100,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x80,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x40,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x20,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x10,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x4,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x8,%eax
jmp    129a <libamg_sip_get_codec_code+0x17a>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"alaw\00"
@.str.1 = [5 x i8] c"ulaw\00"
@.str.2 = [5 x i8] c"g723\00"
@.str.3 = [8 x i8] c"g726-16\00"
@.str.4 = [8 x i8] c"g726-24\00"
@.str.5 = [8 x i8] c"g726-40\00"
@.str.6 = [5 x i8] c"g726\00"
@.str.7 = [5 x i8] c"g729\00"
@.str.8 = [4 x i8] c"gsm\00"
define i32 @libamg_sip_get_codec_code(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 256, i32* %2
br label %58
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @strncmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %9
store i32 128, i32* %2
br label %58
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @strncmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %15
store i32 64, i32* %2
br label %58
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @strncmp(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %21
store i32 32, i32* %2
br label %58
27: ; preds = %21
%28 = load i8*, i8** %3
%29 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @strncmp(i8* %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %27
store i32 16, i32* %2
br label %58
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 @strncmp(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %39, label %38
38: ; preds = %33
store i32 4, i32* %2
br label %58
39: ; preds = %33
%40 = load i8*, i8** %3
%41 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%42 = call i32 @strncmp(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %41)
%43 = icmp ne i32 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %39
store i32 8, i32* %2
br label %58
45: ; preds = %39
%46 = load i8*, i8** %3
%47 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%48 = call i32 @strncmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %47)
%49 = icmp ne i32 %48, 0
br i1 %49, label %51, label %50
50: ; preds = %45
store i32 2, i32* %2
br label %58
51: ; preds = %45
%52 = load i8*, i8** %3
%53 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%54 = call i32 @strncmp(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %57, label %56
56: ; preds = %51
store i32 1, i32* %2
br label %58
57: ; preds = %51
store i32 -1, i32* %2
br label %58
58: ; preds = %57, %56, %50, %44, %38, %32, %26, %20, %14, %8
%59 = load i32, i32* %2
ret i32 %59
}

LLVM IR (-O2):
@.str = [5 x i8] c"alaw\00"
@.str.1 = [5 x i8] c"ulaw\00"
@.str.2 = [5 x i8] c"g723\00"
@.str.3 = [8 x i8] c"g726-16\00"
@.str.4 = [8 x i8] c"g726-24\00"
@.str.5 = [8 x i8] c"g726-40\00"
@.str.6 = [5 x i8] c"g726\00"
@.str.7 = [5 x i8] c"g729\00"
@.str.8 = [4 x i8] c"gsm\00"
define i32 @libamg_sip_get_codec_code(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %38, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %38, label %9
9: ; preds = %5
%10 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %38, label %13
13: ; preds = %9
%14 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %38, label %17
17: ; preds = %13
%18 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%19 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %38, label %21
21: ; preds = %17
%22 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%23 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %38, label %25
25: ; preds = %21
%26 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%27 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %38, label %29
29: ; preds = %25
%30 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%31 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %29
%34 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%35 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i32 1, i32 -1
br label %38
38: ; preds = %33, %29, %25, %21, %17, %13, %9, %5, %1
%39 = phi i32 [ 256, %1 ], [ 128, %5 ], [ 64, %9 ], [ 32, %13 ], [ 16, %17 ], [ 4, %21 ], [ 8, %25 ], [ 2, %29 ], [ %37, %33 ]
ret i32 %39
}