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

/* Variables and functions */
int nfs_probe_mntport(struct sockaddr const *, unsigned int const,
                      struct pmap *);
int /*<<< orphan*/ nfs_probe_nfsport(struct sockaddr const *,
                                     unsigned int const, struct pmap *);
int nfs_probe_version_fixed(const struct sockaddr *mnt_saddr,
                            const unsigned int mnt_salen, struct pmap *mnt_pmap,
                            const struct sockaddr *nfs_saddr,
                            const unsigned int nfs_salen,
                            struct pmap *nfs_pmap) {
  if (!nfs_probe_nfsport(nfs_saddr, nfs_salen, nfs_pmap))
    return 0;
  return nfs_probe_mntport(mnt_saddr, mnt_salen, mnt_pmap);
}


x86 assembly (clang, -O0):
<nfs_probe_version_fixed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdx
call   1030 <nfs_probe_nfsport@plt>
cmp    $0x0,%eax
jne    1164 <nfs_probe_version_fixed+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1177 <nfs_probe_version_fixed+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <nfs_probe_mntport@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfs_probe_version_fixed>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rcx,%rdi
mov    %r8d,%esi
mov    %r9,%rdx
call   1030 <nfs_probe_nfsport@plt>
test   %eax,%eax
je     114f <nfs_probe_version_fixed+0x2f>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <nfs_probe_mntport@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.pmap = type { i32 }
define i32 @nfs_probe_version_fixed(%struct.sockaddr* %0, i32 %1, %struct.pmap* %2, %struct.sockaddr* %3, i32 %4, %struct.pmap* %5) {
%7 = alloca i32
%8 = alloca %struct.sockaddr*
%9 = alloca i32
%10 = alloca %struct.pmap*
%11 = alloca %struct.sockaddr*
%12 = alloca i32
%13 = alloca %struct.pmap*
store %struct.sockaddr* %0, %struct.sockaddr** %8
store i32 %1, i32* %9
store %struct.pmap* %2, %struct.pmap** %10
store %struct.sockaddr* %3, %struct.sockaddr** %11
store i32 %4, i32* %12
store %struct.pmap* %5, %struct.pmap** %13
%14 = load %struct.sockaddr*, %struct.sockaddr** %11
%15 = load i32, i32* %12
%16 = load %struct.pmap*, %struct.pmap** %13
%17 = call i32 @nfs_probe_nfsport(%struct.sockaddr* %14, i32 %15, %struct.pmap* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %6
store i32 0, i32* %7
br label %25
20: ; preds = %6
%21 = load %struct.sockaddr*, %struct.sockaddr** %8
%22 = load i32, i32* %9
%23 = load %struct.pmap*, %struct.pmap** %10
%24 = call i32 @nfs_probe_mntport(%struct.sockaddr* %21, i32 %22, %struct.pmap* %23)
store i32 %24, i32* %7
br label %25
25: ; preds = %20, %19
%26 = load i32, i32* %7
ret i32 %26
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.pmap = type { i32 }
define i32 @nfs_probe_version_fixed(%struct.sockaddr* %0, i32 %1, %struct.pmap* %2, %struct.sockaddr* %3, i32 %4, %struct.pmap* %5) {
%7 = tail call i32 @nfs_probe_nfsport(%struct.sockaddr* %3, i32 %4, %struct.pmap* %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @nfs_probe_mntport(%struct.sockaddr* %0, i32 %1, %struct.pmap* %2)
br label %11
11: ; preds = %6, %9
%12 = phi i32 [ %10, %9 ], [ 0, %6 ]
ret i32 %12
}