#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*/ b;

/* Variables and functions */
int write(int, char *, int);
int xput(int fd, unsigned char c) {
  const char hex[] = "0123456789abcdef";
  char b[4];
  b[0] = '\\';
  b[1] = 'x';
  b[2] = hex[c >> 4];
  b[3] = hex[c & 0x0f];
  return write(fd, b, sizeof(b));
}


x86 assembly (clang, -O0):
<xput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed3(%rip),%al
mov    %al,-0x10(%rbp)
movb   $0x5c,-0x24(%rbp)
movb   $0x78,-0x23(%rbp)
movzbl -0x5(%rbp),%eax
sar    $0x4,%eax
cltq
mov    -0x20(%rbp,%rax,1),%al
mov    %al,-0x22(%rbp)
movzbl -0x5(%rbp),%eax
and    $0xf,%eax
cltq
mov    -0x20(%rbp,%rax,1),%al
mov    %al,-0x21(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xput>:
push   %rax
movw   $0x785c,0x4(%rsp)
mov    %esi,%eax
mov    %rax,%rcx
shr    $0x4,%rcx
lea    0xed8(%rip),%rdx
mov    (%rcx,%rdx,1),%cl
mov    %cl,0x6(%rsp)
and    $0xf,%eax
mov    (%rax,%rdx,1),%al
mov    %al,0x7(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__const.xput.hex = [17 x i8] c"0123456789abcdef\00"
define i32 @xput(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca [17 x i8]
%6 = alloca [4 x i8]
store i32 %0, i32* %3
store i8 %1, i8* %4
%7 = bitcast [17 x i8]* %5 to i8*
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
store i8 92, i8* %8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 1
store i8 120, i8* %9
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = ashr i32 %11, 4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 2
store i8 %15, i8* %16
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = and i32 %18, 15
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 3
store i8 %22, i8* %23
%24 = load i32, i32* %3
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%26 = call i32 @write(i32 %24, i8* %25, i32 4)
ret i32 %26
}

LLVM IR (-O2):
@__const.xput.hex = [17 x i8] c"0123456789abcdef\00"
define i32 @xput(i32 %0, i8 zeroext %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 92, i8* %4
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 120, i8* %5
%6 = zext i8 %1 to i32
%7 = lshr i32 %6, 4
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.xput.hex, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %10, i8* %11
%12 = and i32 %6, 15
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.xput.hex, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %15, i8* %16
%17 = call i32 @write(i32 %0, i8* %4, i32 4)
ret i32 %17
}