#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 */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
char *conf_get_str(char *, char *);
int text2sockaddr(char *, int /*<<< orphan*/, struct sockaddr **,
                  int /*<<< orphan*/, int /*<<< orphan*/);
struct sockaddr *conf_get_address(char *section, char *tag) {
  char *value = conf_get_str(section, tag);
  struct sockaddr *sa;
  if (!value)
    return 0;
  if (text2sockaddr(value, 0, &sa, 0, 0) == -1)
    return 0;
  return sa;
}


x86 assembly (clang, -O0):
<conf_get_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <conf_get_str@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <conf_get_address+0x39>
movq   $0x0,-0x8(%rbp)
jmp    118d <conf_get_address+0x6d>
mov    -0x20(%rbp),%rdi
xor    %r8d,%r8d
lea    -0x28(%rbp),%rdx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1040 <text2sockaddr@plt>
cmp    $0xffffffff,%eax
jne    1185 <conf_get_address+0x65>
movq   $0x0,-0x8(%rbp)
jmp    118d <conf_get_address+0x6d>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_get_address>:
push   %rbx
sub    $0x10,%rsp
call   1030 <conf_get_str@plt>
test   %rax,%rax
je     1151 <conf_get_address+0x31>
lea    0x8(%rsp),%rdx
xor    %ebx,%ebx
mov    %rax,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <text2sockaddr@plt>
cmp    $0xffffffff,%eax
je     1153 <conf_get_address+0x33>
mov    0x8(%rsp),%rbx
jmp    1153 <conf_get_address+0x33>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define %struct.sockaddr* @conf_get_address(i8* %0, i8* %1) {
%3 = alloca %struct.sockaddr*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.sockaddr*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i8* @conf_get_str(i8* %8, i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %2
store %struct.sockaddr* null, %struct.sockaddr** %3
br label %21
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = call i32 @text2sockaddr(i8* %15, i32 0, %struct.sockaddr** %7, i32 0, i32 0)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %14
store %struct.sockaddr* null, %struct.sockaddr** %3
br label %21
19: ; preds = %14
%20 = load %struct.sockaddr*, %struct.sockaddr** %7
store %struct.sockaddr* %20, %struct.sockaddr** %3
br label %21
21: ; preds = %19, %18, %13
%22 = load %struct.sockaddr*, %struct.sockaddr** %3
ret %struct.sockaddr* %22
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define %struct.sockaddr* @conf_get_address(i8* %0, i8* %1) {
%3 = alloca %struct.sockaddr*
%4 = tail call i8* @conf_get_str(i8* %0, i8* %1)
%5 = bitcast %struct.sockaddr** %3 to i8*
%6 = icmp eq i8* %4, null
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = call i32 @text2sockaddr(i8* %4, i32 0, %struct.sockaddr** %3, i32 0, i32 0)
%9 = icmp eq i32 %8, -1
%10 = load %struct.sockaddr*, %struct.sockaddr** %3
%11 = select i1 %9, %struct.sockaddr* null, %struct.sockaddr* %10
br label %12
12: ; preds = %7, %2
%13 = phi %struct.sockaddr* [ null, %2 ], [ %11, %7 ]
ret %struct.sockaddr* %13
}