#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 */
typedef int /*<<< orphan*/ u_char;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ MAXCDNAME;
int MAXDNAME;
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *p_fqnname(int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *, int /*<<< orphan*/,
                              char *, int);
const u_char *p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
  char name[MAXDNAME];
  const u_char *n;
  n = p_fqnname(cp, msg, MAXCDNAME, name, sizeof name);
  if (n == NULL)
    return (NULL);
  fputs(name, file);
  return (n);
}


x86 assembly (clang, -O0):
<p_fqname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e79(%rip),%rdx
mov    (%rdx),%edx
mov    %eax,%r8d
call   1040 <p_fqnname@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    119c <p_fqname+0x7c>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    11b8 <p_fqname+0x98>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_fqname>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    0x2ea4(%rip),%rax
mov    (%rax),%r8d
mov    %rsp,%rbx
mov    %r8,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rcx
call   1040 <p_fqnname@plt>
mov    %rax,%r15
test   %rax,%rax
je     116f <p_fqname+0x4f>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %r15,%rax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MAXDNAME = global i32 0
@MAXCDNAME = global i32 0
define i32* @p_fqname(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32*
%11 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%12 = load i32, i32* @MAXDNAME
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca i8, i64 %13
store i64 %13, i64* %9
%16 = load i32*, i32** %5
%17 = load i32*, i32** %6
%18 = load i32, i32* @MAXCDNAME
%19 = trunc i64 %13 to i32
%20 = call i32* @p_fqnname(i32* %16, i32* %17, i32 %18, i8* %15, i32 %19)
store i32* %20, i32** %10
%21 = load i32*, i32** %10
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %24
23: ; preds = %3
store i32* null, i32** %4
store i32 1, i32* %11
br label %28
24: ; preds = %3
%25 = load i32*, i32** %7
%26 = call i32 @fputs(i8* %15, i32* %25)
%27 = load i32*, i32** %10
store i32* %27, i32** %4
store i32 1, i32* %11
br label %28
28: ; preds = %24, %23
%29 = load i8*, i8** %8
%30 = load i32*, i32** %4
ret i32* %30
}

LLVM IR (-O2):
@MAXDNAME = global i32 0
@MAXCDNAME = global i32 0
define i32* @p_fqname(i32* %0, i32* %1, i32* nocapture %2) {
%4 = load i32, i32* @MAXDNAME
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = load i32, i32* @MAXCDNAME
%8 = call i32* @p_fqnname(i32* %0, i32* %1, i32 %7, i8* %6, i32 %4)
%9 = icmp eq i32* %8, null
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = call i32 @fputs(i8* %6, i32* %2)
br label %12
12: ; preds = %3, %10
ret i32* %8
}