#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 mount_options {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *po_get(struct mount_options *, char *);
char *strdup(char *);
char *nfs_umount_hostname(struct mount_options *options, char *hostname) {
  char *option;
  option = po_get(options, "mountaddr");
  if (option)
    goto out;
  option = po_get(options, "mounthost");
  if (option)
    goto out;
  option = po_get(options, "addr");
  if (option)
    goto out;
  return hostname;
out:
  free(hostname);
  return strdup(option);
}


x86 assembly (clang, -O0):
<nfs_umount_hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <po_get@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1164 <nfs_umount_hostname+0x34>
jmp    11b9 <nfs_umount_hostname+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <po_get@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1188 <nfs_umount_hostname+0x58>
jmp    11b9 <nfs_umount_hostname+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1040 <po_get@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11ac <nfs_umount_hostname+0x7c>
jmp    11b9 <nfs_umount_hostname+0x89>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <nfs_umount_hostname+0x9f>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfs_umount_hostname>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xebe(%rip),%rsi
call   1040 <po_get@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    117d <nfs_umount_hostname+0x4d>
lea    0xeb4(%rip),%rsi
mov    %r15,%rdi
call   1040 <po_get@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    117d <nfs_umount_hostname+0x4d>
lea    0xe98(%rip),%rsi
mov    %r15,%rdi
call   1040 <po_get@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1192 <nfs_umount_hostname+0x62>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <strdup@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.mount_options = type { i32 }
@.str = [10 x i8] c"mountaddr\00"
@.str.1 = [10 x i8] c"mounthost\00"
@.str.2 = [5 x i8] c"addr\00"
define i8* @nfs_umount_hostname(%struct.mount_options* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca %struct.mount_options*
%5 = alloca i8*
%6 = alloca i8*
store %struct.mount_options* %0, %struct.mount_options** %4
store i8* %1, i8** %5
%7 = load %struct.mount_options*, %struct.mount_options** %4
%8 = call i8* @po_get(%struct.mount_options* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
br label %26
12: ; preds = %2
%13 = load %struct.mount_options*, %struct.mount_options** %4
%14 = call i8* @po_get(%struct.mount_options* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %12
br label %26
18: ; preds = %12
%19 = load %struct.mount_options*, %struct.mount_options** %4
%20 = call i8* @po_get(%struct.mount_options* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %24
23: ; preds = %18
br label %26
24: ; preds = %18
%25 = load i8*, i8** %5
store i8* %25, i8** %3
br label %31
26: ; preds = %23, %17, %11
%27 = load i8*, i8** %5
%28 = call i32 @free(i8* %27)
%29 = load i8*, i8** %6
%30 = call i8* @strdup(i8* %29)
store i8* %30, i8** %3
br label %31
31: ; preds = %26, %24
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
%struct.mount_options = type { i32 }
@.str = [10 x i8] c"mountaddr\00"
@.str.1 = [10 x i8] c"mounthost\00"
@.str.2 = [5 x i8] c"addr\00"
define i8* @nfs_umount_hostname(%struct.mount_options* %0, i8* %1) {
%3 = tail call i8* @po_get(%struct.mount_options* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = tail call i8* @po_get(%struct.mount_options* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i8* @po_get(%struct.mount_options* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %8, %5, %2
%12 = phi i8* [ %3, %2 ], [ %6, %5 ], [ %9, %8 ]
%13 = tail call i32 @free(i8* %1)
%14 = tail call i8* @strdup(i8* %12)
br label %15
15: ; preds = %8, %11
%16 = phi i8* [ %14, %11 ], [ %1, %8 ]
ret i8* %16
}