#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 */
scalar_t__ is_dev_type(char const *, char const *, char *);
int dev_type_enum(const char *dev, const char *dev_type) {
  if (is_dev_type(dev, dev_type, "tun")) {
    return 2;
  } else if (is_dev_type(dev, dev_type, "tap")) {
    return 3;
  } else if (is_dev_type(dev, dev_type, "null")) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<dev_type_enum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xed1(%rip),%rdx
call   1030 <is_dev_type@plt>
cmp    $0x0,%rax
je     114a <dev_type_enum+0x3a>
movl   $0x2,-0x4(%rbp)
jmp    11a5 <dev_type_enum+0x95>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xeab(%rip),%rdx
call   1030 <is_dev_type@plt>
cmp    $0x0,%rax
je     1174 <dev_type_enum+0x64>
movl   $0x3,-0x4(%rbp)
jmp    11a5 <dev_type_enum+0x95>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xe85(%rip),%rdx
call   1030 <is_dev_type@plt>
cmp    $0x0,%rax
je     119e <dev_type_enum+0x8e>
movl   $0x1,-0x4(%rbp)
jmp    11a5 <dev_type_enum+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_type_enum>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdx
call   1030 <is_dev_type@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    116f <dev_type_enum+0x5f>
lea    0xeca(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <is_dev_type@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    116f <dev_type_enum+0x5f>
lea    0xeaf(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <is_dev_type@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"tun\00"
@.str.1 = [4 x i8] c"tap\00"
@.str.2 = [5 x i8] c"null\00"
define i32 @dev_type_enum(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = call i64 @is_dev_type(i8* %6, i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 2, i32* %3
br label %24
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = call i64 @is_dev_type(i8* %12, i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 3, i32* %3
br label %24
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = call i64 @is_dev_type(i8* %18, i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 1, i32* %3
br label %24
23: ; preds = %17
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %16, %10
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [4 x i8] c"tun\00"
@.str.1 = [4 x i8] c"tap\00"
@.str.2 = [5 x i8] c"null\00"
define i32 @dev_type_enum(i8* %0, i8* %1) {
%3 = tail call i64 @is_dev_type(i8* %0, i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i64 @is_dev_type(i8* %0, i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = tail call i64 @is_dev_type(i8* %0, i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %5, %2
%13 = phi i32 [ 2, %2 ], [ 3, %5 ], [ %11, %8 ]
ret i32 %13
}