#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 */
typedef int u_int;

/* Variables and functions */
int AF_INET;
int AF_UNSPEC;
int /*<<< orphan*/ strcmp(char const *, char *);
u_int cnupm_family(const char *family) {
  if (!strcmp(family, "inet"))
    return (AF_INET);
  if (!strcmp(family, "inet6"))
    return (24);
  return (AF_UNSPEC);
}


x86 assembly (clang, -O0):
<cnupm_family>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1146 <cnupm_family+0x36>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <cnupm_family+0x67>
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    116b <cnupm_family+0x5b>
movl   $0x18,-0x4(%rbp)
jmp    1177 <cnupm_family+0x67>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cnupm_family>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1147 <cnupm_family+0x37>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x18,%eax
test   %ecx,%ecx
je     1150 <cnupm_family+0x40>
mov    0x2e9b(%rip),%rax
jmp    114e <cnupm_family+0x3e>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"inet\00"
@AF_INET = global i32 0
@.str.1 = [6 x i8] c"inet6\00"
@AF_UNSPEC = global i32 0
define i32 @cnupm_family(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = load i32, i32* @AF_INET
store i32 %8, i32* %2
br label %16
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
store i32 24, i32* %2
br label %16
14: ; preds = %9
%15 = load i32, i32* @AF_UNSPEC
store i32 %15, i32* %2
br label %16
16: ; preds = %14, %13, %7
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [5 x i8] c"inet\00"
@AF_INET = global i32 0
@.str.1 = [6 x i8] c"inet6\00"
@AF_UNSPEC = global i32 0
define i32 @cnupm_family(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load i32, i32* @AF_INET
br label %11
6: ; preds = %1
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = load i32, i32* @AF_UNSPEC
%10 = select i1 %8, i32 24, i32 %9
br label %11
11: ; preds = %6, %4
%12 = phi i32 [ %5, %4 ], [ %10, %6 ]
ret i32 %12
}