#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 */
struct xlat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tprintf(char *, ...);
char *xlookup(struct xlat const *, int);
void printxval(const struct xlat *xlat, int val, const char *dflt) {
  const char *str = xlookup(xlat, val);
  if (str)
    tprintf("%s", str);
  else
    tprintf("%#x /* %s */", val, dflt);
}


x86 assembly (clang, -O0):
<printxval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <xlookup@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1165 <printxval+0x45>
mov    -0x20(%rbp),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
jmp    117a <printxval+0x5a>
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printxval>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
call   1030 <xlookup@plt>
test   %rax,%rax
je     1149 <printxval+0x29>
lea    0xec7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <tprintf@plt>
lea    0xeb3(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <tprintf@plt>

LLVM IR (-O0):
%struct.xlat = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"%#x /* %s */\00"
define void @printxval(%struct.xlat* %0, i32 %1, i8* %2) {
%4 = alloca %struct.xlat*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store %struct.xlat* %0, %struct.xlat** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load %struct.xlat*, %struct.xlat** %4
%9 = load i32, i32* %5
%10 = call i8* @xlookup(%struct.xlat* %8, i32 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i8*, i8** %7
%15 = call i32 (i8*, ...) @tprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %20
16: ; preds = %3
%17 = load i32, i32* %5
%18 = load i8*, i8** %6
%19 = call i32 (i8*, ...) @tprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %17, i8* %18)
br label %20
20: ; preds = %16, %13
ret void
}

LLVM IR (-O2):
%struct.xlat = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"%#x /* %s */\00"
define void @printxval(%struct.xlat* %0, i32 %1, i8* %2) {
%4 = tail call i8* @xlookup(%struct.xlat* %0, i32 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @tprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %10
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @tprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %2)
br label %10
10: ; preds = %8, %6
ret void
}