#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 */
char *fdpathdb_find_path(int);
int /*<<< orphan*/ fdpathdb_register_mapped_path(char const *, int,
                                                 char const *, char const *);
char *strdup(char const *);
void dup_postprocess_(const char *realfnname, int ret, int fd) {
  const char *cp = NULL;
  if (ret >= 0) {
    cp = fdpathdb_find_path(fd);
    if (cp)
      cp = strdup(cp);
    fdpathdb_register_mapped_path(realfnname, ret, cp, cp);
  }
}


x86 assembly (clang, -O0):
<dup_postprocess_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     118c <dup_postprocess_+0x5c>
mov    -0x10(%rbp),%edi
call   1040 <fdpathdb_find_path@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1178 <dup_postprocess_+0x48>
mov    -0x18(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <fdpathdb_register_mapped_path@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dup_postprocess_>:
test   %esi,%esi
js     1156 <dup_postprocess_+0x26>
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %edx,%edi
call   1040 <fdpathdb_find_path@plt>
test   %rax,%rax
je     1157 <dup_postprocess_+0x27>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
jmp    1159 <dup_postprocess_+0x29>
ret
xor    %ecx,%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rcx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fdpathdb_register_mapped_path@plt>

LLVM IR (-O0):
define void @dup_postprocess_(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i8* null, i8** %7
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %3
%11 = load i32, i32* %6
%12 = call i8* @fdpathdb_find_path(i32 %11)
store i8* %12, i8** %7
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %7
%17 = call i8* @strdup(i8* %16)
store i8* %17, i8** %7
br label %18
18: ; preds = %15, %10
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = load i8*, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @fdpathdb_register_mapped_path(i8* %19, i32 %20, i8* %21, i8* %22)
br label %24
24: ; preds = %18, %3
ret void
}

LLVM IR (-O2):
define void @dup_postprocess_(i8* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, -1
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = tail call i8* @fdpathdb_find_path(i32 %2)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i8* @strdup(i8* %6)
br label %10
10: ; preds = %8, %5
%11 = phi i8* [ %9, %8 ], [ null, %5 ]
%12 = tail call i32 @fdpathdb_register_mapped_path(i8* %0, i32 %1, i8* %11, i8* %11)
br label %13
13: ; preds = %10, %3
ret void
}