#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char const *, char const *);
int check_nettype(const char *name, const char *list_to_check[]) {
  int i;
  for (i = 0; list_to_check[i] != NULL; i++) {
    if (strcmp(name, list_to_check[i]) == 0) {
      return 1;
    }
  }
  (void)fprintf(stderr, "illegal nettype :\'%s\'\n", name);
  return 0;
}


x86 assembly (clang, -O0):
<check_nettype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1188 <check_nettype+0x68>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1175 <check_nettype+0x55>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <check_nettype+0x88>
jmp    117a <check_nettype+0x5a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <check_nettype+0x17>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe64(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_nettype>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1159 <check_nettype+0x39>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1175 <check_nettype+0x55>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1140 <check_nettype+0x20>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
jmp    117a <check_nettype+0x5a>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"illegal nettype :'%s'\0A\00"
define i32 @check_nettype(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %25, %2
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %28
14: ; preds = %7
%15 = load i8*, i8** %4
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %15, i8* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %14
store i32 1, i32* %3
br label %32
24: ; preds = %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %7
28: ; preds = %7
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %4
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %30)
store i32 0, i32* %3
br label %32
32: ; preds = %28, %23
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"illegal nettype :'%s'\0A\00"
define i32 @check_nettype(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8*, i8** %1, i64 %14
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %15, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %14, %5 ], [ 0, %2 ]
%11 = phi i8* [ %7, %5 ], [ %3, %2 ]
%12 = tail call i64 @strcmp(i8* %0, i8* %11)
%13 = icmp eq i64 %12, 0
%14 = add nuw i64 %10, 1
br i1 %13, label %18, label %5
15: ; preds = %5, %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %18
18: ; preds = %9, %15
%19 = phi i32 [ 0, %15 ], [ 1, %9 ]
ret i32 %19
}