#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 */
char *config_get(char *);
char *mtu_name(void) {
  char *p;
  p = config_get("internet_type");
  if (*p == '0') {
    p = config_get("internet_ppp_type");
    switch (*p) {
    case '0':
      p = "wan_pppoe_mtu";
      break;
    case '1':
      p = "wan_pptp_mtu";
      break;
    case '3':
      p = "wan_mulppp_mtu";
      break;
    default:
      p = "wan_dhcp_mtu";
    }
  } else {
    p = "wan_dhcp_mtu";
  }
  return p;
}


x86 assembly (clang, -O0):
<mtu_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <config_get@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11c2 <mtu_name+0xb2>
lea    0xecf(%rip),%rdi
call   1030 <config_get@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
sub    $0x30,%eax
je     1182 <mtu_name+0x72>
jmp    1160 <mtu_name+0x50>
mov    -0xc(%rbp),%eax
sub    $0x31,%eax
je     1192 <mtu_name+0x82>
jmp    1171 <mtu_name+0x61>
mov    -0xc(%rbp),%eax
sub    $0x33,%eax
je     11a2 <mtu_name+0x92>
jmp    11b2 <mtu_name+0xa2>
lea    0xe97(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mtu_name+0xad>
lea    0xe95(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mtu_name+0xad>
lea    0xe92(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mtu_name+0xad>
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <mtu_name+0xbd>
lea    0xe81(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtu_name>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <config_get@plt>
lea    0xf26(%rip),%rbx
cmpb   $0x30,(%rax)
jne    1150 <mtu_name+0x40>
lea    0xede(%rip),%rdi
call   1030 <config_get@plt>
movsbq (%rax),%rax
add    $0xffffffffffffffd0,%rax
cmp    $0x3,%eax
ja     1150 <mtu_name+0x40>
lea    0xf0f(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"internet_type\00"
@.str.1 = [18 x i8] c"internet_ppp_type\00"
@.str.2 = [14 x i8] c"wan_pppoe_mtu\00"
@.str.3 = [13 x i8] c"wan_pptp_mtu\00"
@.str.4 = [15 x i8] c"wan_mulppp_mtu\00"
@.str.5 = [13 x i8] c"wan_dhcp_mtu\00"
define i8* @mtu_name() {
%1 = alloca i8*
%2 = call i8* @config_get(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 48
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = call i8* @config_get(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %1
%9 = load i8*, i8** %1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %15 [
i32 48, label %12
i32 49, label %13
i32 51, label %14
]
12: ; preds = %7
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %16
13: ; preds = %7
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %16
14: ; preds = %7
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %16
15: ; preds = %7
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %1
br label %16
16: ; preds = %15, %14, %13, %12
br label %18
17: ; preds = %0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %1
br label %18
18: ; preds = %17, %16
%19 = load i8*, i8** %1
ret i8* %19
}

LLVM IR (-O2):
@.str = [14 x i8] c"internet_type\00"
@.str.1 = [18 x i8] c"internet_ppp_type\00"
@.str.2 = [14 x i8] c"wan_pppoe_mtu\00"
@.str.3 = [13 x i8] c"wan_pptp_mtu\00"
@.str.4 = [15 x i8] c"wan_mulppp_mtu\00"
@.str.5 = [13 x i8] c"wan_dhcp_mtu\00"
@reltable.mtu_name = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.mtu_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.mtu_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.5 to i64), i64 ptrtoint ([4 x i32]* @reltable.mtu_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.mtu_name to i64)) to i32)]
define i8* @mtu_name() {
%1 = tail call i8* @config_get(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i8, i8* %1
%3 = icmp eq i8 %2, 48
br i1 %3, label %4, label %14
4: ; preds = %0
%5 = tail call i8* @config_get(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = add nsw i32 %7, -48
%9 = icmp ult i32 %8, 4
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = sext i32 %8 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.mtu_name to i8*), i64 %12)
br label %14
14: ; preds = %4, %10, %0
%15 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), %0 ], [ %13, %10 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), %4 ]
ret i8* %15
}