#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 */
int /*<<< orphan*/ bufprintf(char *, int, char *, char *);
char *print_address(char *value, char *alt, char *buf, int buflen) {
  if (value != NULL && *value)
    bufprintf(buf, buflen, "<yellow> %s", value);
  else
    bufprintf(buf, buflen, "<white> <unknown%s>", alt);
  return buf;
}


x86 assembly (clang, -O0):
<print_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115e <print_address+0x4e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <print_address+0x4e>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rcx
lea    0xeac(%rip),%rdx
call   1030 <bufprintf@plt>
jmp    1175 <print_address+0x65>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xe9c(%rip),%rdx
call   1030 <bufprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_address>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r8
test   %rdi,%rdi
je     1135 <print_address+0x25>
mov    %rdi,%rax
cmpb   $0x0,(%rdi)
je     1135 <print_address+0x25>
lea    0xed5(%rip),%rdx
mov    %rbx,%rdi
mov    %ecx,%esi
mov    %rax,%rcx
jmp    1144 <print_address+0x34>
lea    0xed0(%rip),%rdx
mov    %rbx,%rdi
mov    %ecx,%esi
mov    %r8,%rcx
call   1030 <bufprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"<yellow> %s\00"
@.str.1 = [20 x i8] c"<white> <unknown%s>\00"
define i8* @print_address(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %21
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = load i8*, i8** %5
%20 = call i32 @bufprintf(i8* %17, i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %26
21: ; preds = %11, %4
%22 = load i8*, i8** %7
%23 = load i32, i32* %8
%24 = load i8*, i8** %6
%25 = call i32 @bufprintf(i8* %22, i32 %23, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %21, %16
%27 = load i8*, i8** %7
ret i8* %27
}

LLVM IR (-O2):
@.str = [12 x i8] c"<yellow> %s\00"
@.str.1 = [20 x i8] c"<white> <unknown%s>\00"
define i8* @print_address(i8* %0, i8* %1, i8* returned %2, i32 %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @bufprintf(i8* %2, i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %13
11: ; preds = %6, %4
%12 = tail call i32 @bufprintf(i8* %2, i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %13
13: ; preds = %11, %9
ret i8* %2
}