#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 */
char *malloc(int);
char valueToHexDigit(unsigned char);
char *lowerCharToUnicode(unsigned char c, size_t *len) {
  char *out = NULL;
  unsigned char higherDigit = (unsigned char)c / 16;
  unsigned char lowerDigit = c - (higherDigit * 16);
  *len = 6;
  out = malloc(sizeof(char) * 6);
  out[0] = '\\';
  out[1] = 'u';
  out[2] = '0';
  out[3] = '0';
  out[4] = valueToHexDigit(higherDigit);
  out[5] = valueToHexDigit(lowerDigit);
  return out;
}


x86 assembly (clang, -O0):
<lowerCharToUnicode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %al,-0x19(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x19(%rbp),%ecx
shl    $0x4,%ecx
sub    %ecx,%eax
mov    %al,-0x1a(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x6,(%rax)
mov    $0x6,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x75,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x30,0x2(%rax)
mov    -0x18(%rbp),%rax
movb   $0x30,0x3(%rax)
movzbl -0x19(%rbp),%edi
call   1040 <valueToHexDigit@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x4(%rax)
movzbl -0x1a(%rbp),%edi
call   1040 <valueToHexDigit@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowerCharToUnicode>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    %ebp,%r14d
shr    $0x4,%r14b
movq   $0x6,(%rsi)
mov    $0x6,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
movl   $0x3030755c,(%rax)
movzbl %r14b,%edi
call   1040 <valueToHexDigit@plt>
mov    %al,0x4(%rbx)
and    $0xf,%ebp
mov    %ebp,%edi
call   1040 <valueToHexDigit@plt>
mov    %al,0x5(%rbx)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @lowerCharToUnicode(i8 zeroext %0, i64* %1) {
%3 = alloca i8
%4 = alloca i64*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %3
store i64* %1, i64** %4
store i8* null, i8** %5
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = sdiv i32 %9, 16
%11 = trunc i32 %10 to i8
store i8 %11, i8* %6
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = mul nsw i32 %15, 16
%17 = sub nsw i32 %13, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i64*, i64** %4
store i64 6, i64* %19
%20 = call i8* @malloc(i32 6)
store i8* %20, i8** %5
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 0
store i8 92, i8* %22
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8 117, i8* %24
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 2
store i8 48, i8* %26
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 3
store i8 48, i8* %28
%29 = load i8, i8* %6
%30 = call signext i8 @valueToHexDigit(i8 zeroext %29)
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i64 4
store i8 %30, i8* %32
%33 = load i8, i8* %7
%34 = call signext i8 @valueToHexDigit(i8 zeroext %33)
%35 = load i8*, i8** %5
%36 = getelementptr inbounds i8, i8* %35, i64 5
store i8 %34, i8* %36
%37 = load i8*, i8** %5
ret i8* %37
}

LLVM IR (-O2):
define noalias i8* @lowerCharToUnicode(i8 zeroext %0, i64* nocapture writeonly %1) {
%3 = lshr i8 %0, 4
%4 = and i8 %0, 15
store i64 6, i64* %1
%5 = tail call dereferenceable_or_null(6) i8* @malloc(i32 6)
store i8 92, i8* %5
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 117, i8* %6
%7 = getelementptr inbounds i8, i8* %5, i64 2
store i8 48, i8* %7
%8 = getelementptr inbounds i8, i8* %5, i64 3
store i8 48, i8* %8
%9 = tail call signext i8 @valueToHexDigit(i8 zeroext %3)
%10 = getelementptr inbounds i8, i8* %5, i64 4
store i8 %9, i8* %10
%11 = tail call signext i8 @valueToHexDigit(i8 zeroext %4)
%12 = getelementptr inbounds i8, i8* %5, i64 5
store i8 %11, i8* %12
ret i8* %5
}