#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 */
size_t strlcat(char *, char const *, size_t);
size_t strlcpy(char *, char const *, size_t);
size_t profile_name(const char *in, char *out, size_t len) {
  static const char *nul = "NULL";
  if (*in == '\0')
    return strlcpy(out, nul, len);
  (void)strlcpy(out, "\"", len);
  (void)strlcat(out, in, len);
  return strlcat(out, "\"", len);
}


x86 assembly (clang, -O0):
<profile_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1161 <profile_name+0x41>
mov    -0x18(%rbp),%rdi
mov    0x2ee1(%rip),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <strlcpy@plt>
mov    %rax,-0x8(%rbp)
jmp    119e <profile_name+0x7e>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe95(%rip),%rsi
call   1040 <strlcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <strlcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe70(%rip),%rsi
call   1030 <strlcat@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<profile_name>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
cmpb   $0x0,(%rdi)
je     1172 <profile_name+0x52>
mov    %rdi,%r15
lea    0xec8(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <strlcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <strlcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <strlcat@plt>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <strlcpy@plt>

LLVM IR (-O0):
@profile_name.nul = internal global i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0)
@.str = [5 x i8] c"NULL\00"
@.str.1 = [2 x i8] c"\22\00"
define i64 @profile_name(i8* %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %6
%14 = load i8*, i8** @profile_name.nul
%15 = load i64, i64* %7
%16 = call i64 @strlcpy(i8* %13, i8* %14, i64 %15)
store i64 %16, i64* %4
br label %28
17: ; preds = %3
%18 = load i8*, i8** %6
%19 = load i64, i64* %7
%20 = call i64 @strlcpy(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 %19)
%21 = load i8*, i8** %6
%22 = load i8*, i8** %5
%23 = load i64, i64* %7
%24 = call i64 @strlcat(i8* %21, i8* %22, i64 %23)
%25 = load i8*, i8** %6
%26 = load i64, i64* %7
%27 = call i64 @strlcat(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 %26)
store i64 %27, i64* %4
br label %28
28: ; preds = %17, %12
%29 = load i64, i64* %4
ret i64 %29
}

LLVM IR (-O2):
@.str = [5 x i8] c"NULL\00"
@.str.1 = [2 x i8] c"\22\00"
define i64 @profile_name(i8* %0, i8* %1, i64 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i64 @strlcpy(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
br label %12
8: ; preds = %3
%9 = tail call i64 @strlcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 %2)
%10 = tail call i64 @strlcat(i8* %1, i8* %0, i64 %2)
%11 = tail call i64 @strlcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 %2)
br label %12
12: ; preds = %8, %6
%13 = phi i64 [ %7, %6 ], [ %11, %8 ]
ret i64 %13
}