#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 check_address(char *);
int check_network(char *);
int check_port(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int check_member(char *type, char *member) {
  if (strcmp(type, "port") == 0)
    return (check_port(member));
  else if (strcmp(type, "address") == 0)
    return (check_address(member));
  else if (strcmp(type, "network") == 0)
    return (check_network(member));
  else {
    printf("%s is not a valid type\n", type);
    return 1;
  }
}


x86 assembly (clang, -O0):
<check_member>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    118b <check_member+0x3b>
mov    -0x18(%rbp),%rdi
call   1070 <check_port@plt>
mov    %eax,-0x4(%rbp)
jmp    11f8 <check_member+0xa8>
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <check_member+0x66>
mov    -0x18(%rbp),%rdi
call   1050 <check_address@plt>
mov    %eax,-0x4(%rbp)
jmp    11f8 <check_member+0xa8>
mov    -0x10(%rbp),%rdi
lea    0xe4c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <check_member+0x91>
mov    -0x18(%rbp),%rdi
call   1060 <check_network@plt>
mov    %eax,-0x4(%rbp)
jmp    11f8 <check_member+0xa8>
mov    -0x10(%rbp),%rsi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_member>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11af <check_member+0x5f>
lea    0xe93(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11be <check_member+0x6e>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11cd <check_member+0x7d>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <check_port@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <check_address@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <check_network@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"port\00"
@.str.1 = [8 x i8] c"address\00"
@.str.2 = [8 x i8] c"network\00"
@.str.3 = [24 x i8] c"%s is not a valid type\0A\00"
define i32 @check_member(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 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = call i32 @check_port(i8* %10)
store i32 %11, i32* %3
br label %29
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = call i32 @check_address(i8* %17)
store i32 %18, i32* %3
br label %29
19: ; preds = %12
%20 = load i8*, i8** %4
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i8*, i8** %5
%25 = call i32 @check_network(i8* %24)
store i32 %25, i32* %3
br label %29
26: ; preds = %19
%27 = load i8*, i8** %4
%28 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %27)
store i32 1, i32* %3
br label %29
29: ; preds = %26, %23, %16, %9
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [5 x i8] c"port\00"
@.str.1 = [8 x i8] c"address\00"
@.str.2 = [8 x i8] c"network\00"
@.str.3 = [24 x i8] c"%s is not a valid type\0A\00"
define i32 @check_member(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @check_port(i8* %1)
br label %19
7: ; preds = %2
%8 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @check_address(i8* %1)
br label %19
12: ; preds = %7
%13 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @check_network(i8* %1)
br label %19
17: ; preds = %12
%18 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %19
19: ; preds = %17, %15, %10, %5
%20 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %16, %15 ], [ 1, %17 ]
ret i32 %20
}