#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 kore_server_bind(char *, char *, char *);
int /*<<< orphan*/ kore_split_string(char *, char *, char **, int);
int configure_bind(char *options) {
  char *argv[4];
  kore_split_string(options, " ", argv, 4);
  if (argv[0] == NULL || argv[1] == NULL)
    return (0);
  return (kore_server_bind(argv[0], argv[1], argv[2]));
}


x86 assembly (clang, -O0):
<configure_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xec5(%rip),%rsi
mov    $0x4,%ecx
call   1030 <kore_split_string@plt>
cmpq   $0x0,-0x30(%rbp)
je     115b <configure_bind+0x3b>
cmpq   $0x0,-0x28(%rbp)
jne    1167 <configure_bind+0x47>
movl   $0x0,-0x4(%rbp)
jmp    117b <configure_bind+0x5b>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <kore_server_bind@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configure_bind>:
sub    $0x28,%rsp
lea    0xed5(%rip),%rsi
mov    %rsp,%rdx
mov    $0x4,%ecx
call   1030 <kore_split_string@plt>
mov    (%rsp),%rdi
xor    %eax,%eax
test   %rdi,%rdi
je     1157 <configure_bind+0x37>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
je     1157 <configure_bind+0x37>
mov    0x10(%rsp),%rdx
call   1040 <kore_server_bind@plt>
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @configure_bind(i8* %0) {
%2 = alloca [4 x i8*]
%3 = bitcast [4 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%5 = call i32 @kore_split_string(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4, i32 4)
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
%8 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
%11 = select i1 %7, i1 true, i1 %10
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @kore_server_bind(i8* %6, i8* %9, i8* %14)
br label %16
16: ; preds = %1, %12
%17 = phi i32 [ %15, %12 ], [ 0, %1 ]
ret i32 %17
}