#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 */
scalar_t__ PATH_MAX;
int /*<<< orphan*/ _citrus_esdb_alias(char const *, char *, size_t);
char *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
const char *_citrus_iconv_canonicalize(const char *name) {
  char *buf;
  if ((buf = malloc((size_t)PATH_MAX)) == NULL)
    return (NULL);
  memset((void *)buf, 0, (size_t)PATH_MAX);
  _citrus_esdb_alias(name, buf, (size_t)PATH_MAX);
  return (buf);
}


x86 assembly (clang, -O0):
<_citrus_iconv_canonicalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1166 <_citrus_iconv_canonicalize+0x36>
movq   $0x0,-0x8(%rbp)
jmp    119a <_citrus_iconv_canonicalize+0x6a>
mov    -0x18(%rbp),%rdi
mov    0x2e7f(%rip),%rax
mov    (%rax),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e66(%rip),%rax
mov    (%rax),%rdx
call   1030 <_citrus_esdb_alias@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_citrus_iconv_canonicalize>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2eae(%rip),%r12
mov    (%r12),%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1172 <_citrus_iconv_canonicalize+0x42>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1040 <memset@plt>
mov    (%r12),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <_citrus_esdb_alias@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@PATH_MAX = global i64 0
define i8* @_citrus_iconv_canonicalize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i64, i64* @PATH_MAX
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %18
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i64, i64* @PATH_MAX
%12 = call i32 @memset(i8* %10, i32 0, i64 %11)
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = load i64, i64* @PATH_MAX
%16 = call i32 @_citrus_esdb_alias(i8* %13, i8* %14, i64 %15)
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %9, %8
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@PATH_MAX = global i64 0
define i8* @_citrus_iconv_canonicalize(i8* %0) {
%2 = load i64, i64* @PATH_MAX
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i32 @memset(i8* %3, i32 0, i64 %2)
%7 = load i64, i64* @PATH_MAX
%8 = tail call i32 @_citrus_esdb_alias(i8* %0, i8* %3, i64 %7)
br label %9
9: ; preds = %1, %5
ret i8* %3
}