#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*/ output_char(long);
void output_q_hex(long n) {
  long num;
  long c;
  long num2;
  long i;
  num = n;
  num2 = n;
  output_char((long)'0');
  output_char((long)'x');
  num2 = 0;
  i = 0;
output_q_hex_j1:
  c = num & 0xF;
  num = num / 16;
  num2 = num2 * 16;
  num2 = num2 + c;
  i = i + 1;
  if (i < 15) {
    goto output_q_hex_j1;
  }
  i = 0;
output_q_hex_j2:
  c = num2 & 0xF;
  num2 = num2 / 16;
  if (c < 10) {
    c = c + 48;
  } else {
    c = c + 55;
  }
  output_char((long)c);
  i = i + 1;
  if (i < 15) {
    goto output_q_hex_j2;
  }
  return;
}


x86 assembly (clang, -O0):
<output_q_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x30,%edi
call   1030 <output_char@plt>
mov    $0x78,%edi
call   1030 <output_char@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
and    $0xf,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
shl    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0xf,-0x28(%rbp)
jge    11a2 <output_q_hex+0x92>
jmp    1150 <output_q_hex+0x40>
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
and    $0xf,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
cmpq   $0xa,-0x18(%rbp)
jge    11e4 <output_q_hex+0xd4>
mov    -0x18(%rbp),%rax
add    $0x30,%rax
mov    %rax,-0x18(%rbp)
jmp    11f0 <output_q_hex+0xe0>
mov    -0x18(%rbp),%rax
add    $0x37,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <output_char@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0xf,-0x28(%rbp)
jge    1215 <output_q_hex+0x105>
jmp    11aa <output_q_hex+0x9a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_q_hex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
movabs $0xffffffffffffff,%rax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x40(%rsp)
movabs $0xfffffffffffff,%rax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x38(%rsp)
movabs $0xffffffffffff,%rax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x30(%rsp)
movabs $0xfffffffffff,%rax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x28(%rsp)
movabs $0xffffffffff,%rax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x20(%rsp)
movabs $0xfffffffff,%rax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x18(%rsp)
mov    $0xffffffff,%eax
add    %rdi,%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x10(%rsp)
lea    0xfffffff(%rdi),%eax
test   %rdi,%rdi
cmovns %ebx,%eax
mov    %rax,(%rsp)
lea    0xffffff(%rdi),%rax
test   %rdi,%rdi
cmovns %rdi,%rax
mov    %rax,0x8(%rsp)
lea    0xfffff(%rdi),%r13d
test   %rdi,%rdi
cmovns %ebx,%r13d
lea    0xffff(%rdi),%rbp
test   %rdi,%rdi
cmovns %rdi,%rbp
lea    0xfff(%rdi),%r14d
test   %rdi,%rdi
cmovns %ebx,%r14d
lea    0xff(%rdi),%r15
test   %rdi,%rdi
cmovns %rdi,%r15
lea    0xf(%rdi),%r12d
test   %rdi,%rdi
cmovns %ebx,%r12d
mov    $0x30,%edi
call   1030 <output_char@plt>
mov    $0x78,%edi
call   1030 <output_char@plt>
shr    $0x4,%r12d
and    $0xf,%r12d
shl    $0x4,%ebx
movzbl %bl,%eax
or     %r12,%rax
shr    $0xc,%r14d
and    $0xf,%r14d
shl    $0x8,%rax
shr    $0x4,%r15d
and    $0xfffffff0,%r15d
movzbl %r15b,%ecx
or     %rax,%rcx
or     %r14,%rcx
shr    $0x14,%r13d
and    $0xf,%r13d
shl    $0x8,%rcx
shr    $0xc,%ebp
and    $0xfffffff0,%ebp
movzbl %bpl,%eax
or     %rcx,%rax
or     %r13,%rax
mov    (%rsp),%rdx
shr    $0x1c,%edx
mov    0x10(%rsp),%rdi
shr    $0x20,%rdi
shl    $0x8,%rax
mov    0x8(%rsp),%rcx
shr    $0x14,%ecx
and    $0xfffffff0,%ecx
movzbl %cl,%ecx
or     %rax,%rcx
or     %rdx,%rcx
mov    0x18(%rsp),%rax
shr    $0x24,%rax
and    $0xf,%eax
mov    %rax,%rdx
mov    0x20(%rsp),%rsi
shr    $0x28,%rsi
shl    $0x8,%rcx
mov    %rdi,%rax
shl    $0x4,%eax
movzbl %al,%eax
or     %rcx,%rax
or     %rdx,%rax
mov    0x28(%rsp),%rcx
shr    $0x2c,%rcx
and    $0xf,%ecx
mov    %rcx,%rdx
mov    0x30(%rsp),%rdi
shr    $0x30,%rdi
shl    $0x8,%rax
mov    %rsi,%rcx
shl    $0x4,%ecx
movzbl %cl,%ecx
or     %rax,%rcx
or     %rdx,%rcx
mov    0x38(%rsp),%rax
shr    $0x34,%rax
and    $0xf,%eax
mov    %rax,%rsi
mov    0x40(%rsp),%rdx
shr    $0x38,%rdx
shl    $0x8,%rcx
mov    %rdi,%rax
shl    $0x4,%eax
movzbl %al,%eax
or     %rcx,%rax
or     %rsi,%rax
mov    %rdx,%rcx
and    $0xf,%ecx
shl    $0x4,%rax
or     %rcx,%rax
mov    $0xf,%ebx
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
and    $0xf,%ecx
lea    0xf(%rax),%rbp
test   %rax,%rax
cmovns %rax,%rbp
sar    $0x4,%rbp
lea    0x30(%rcx),%rax
lea    0x37(%rcx),%rdi
cmp    $0xa,%rcx
cmovb  %rax,%rdi
call   1030 <output_char@plt>
mov    %rbp,%rax
add    $0xffffffffffffffff,%rbx
jne    1350 <output_q_hex+0x240>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @output_q_hex(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %2
%7 = load i64, i64* %2
store i64 %7, i64* %3
%8 = load i64, i64* %2
store i64 %8, i64* %5
%9 = call i32 @output_char(i64 48)
%10 = call i32 @output_char(i64 120)
store i64 0, i64* %5
store i64 0, i64* %6
br label %11
11: ; preds = %25, %1
%12 = load i64, i64* %3
%13 = and i64 %12, 15
store i64 %13, i64* %4
%14 = load i64, i64* %3
%15 = sdiv i64 %14, 16
store i64 %15, i64* %3
%16 = load i64, i64* %5
%17 = mul nsw i64 %16, 16
store i64 %17, i64* %5
%18 = load i64, i64* %5
%19 = load i64, i64* %4
%20 = add nsw i64 %18, %19
store i64 %20, i64* %5
%21 = load i64, i64* %6
%22 = add nsw i64 %21, 1
store i64 %22, i64* %6
%23 = load i64, i64* %6
%24 = icmp slt i64 %23, 15
br i1 %24, label %25, label %26
25: ; preds = %11
br label %11
26: ; preds = %11
store i64 0, i64* %6
br label %27
27: ; preds = %47, %26
%28 = load i64, i64* %5
%29 = and i64 %28, 15
store i64 %29, i64* %4
%30 = load i64, i64* %5
%31 = sdiv i64 %30, 16
store i64 %31, i64* %5
%32 = load i64, i64* %4
%33 = icmp slt i64 %32, 10
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = load i64, i64* %4
%36 = add nsw i64 %35, 48
store i64 %36, i64* %4
br label %40
37: ; preds = %27
%38 = load i64, i64* %4
%39 = add nsw i64 %38, 55
store i64 %39, i64* %4
br label %40
40: ; preds = %37, %34
%41 = load i64, i64* %4
%42 = call i32 @output_char(i64 %41)
%43 = load i64, i64* %6
%44 = add nsw i64 %43, 1
store i64 %44, i64* %6
%45 = load i64, i64* %6
%46 = icmp slt i64 %45, 15
br i1 %46, label %47, label %48
47: ; preds = %40
br label %27
48: ; preds = %40
ret void
}

LLVM IR (-O2):
define void @output_q_hex(i64 %0) {
%2 = tail call i32 @output_char(i64 48)
%3 = tail call i32 @output_char(i64 120)
%4 = sdiv i64 %0, 16
%5 = and i64 %4, 15
%6 = sdiv i64 %0, 256
%7 = shl i64 %0, 4
%8 = and i64 %7, 240
%9 = or i64 %8, %5
%10 = sdiv i64 %0, 4096
%11 = and i64 %10, 15
%12 = sdiv i64 %0, 65536
%13 = shl nuw nsw i64 %9, 8
%14 = shl nsw i64 %6, 4
%15 = and i64 %14, 240
%16 = or i64 %13, %15
%17 = or i64 %16, %11
%18 = sdiv i64 %0, 1048576
%19 = and i64 %18, 15
%20 = sdiv i64 %0, 16777216
%21 = shl nuw nsw i64 %17, 8
%22 = shl nsw i64 %12, 4
%23 = and i64 %22, 240
%24 = or i64 %21, %23
%25 = or i64 %24, %19
%26 = sdiv i64 %0, 268435456
%27 = and i64 %26, 15
%28 = sdiv i64 %0, 4294967296
%29 = shl i64 %25, 8
%30 = shl nsw i64 %20, 4
%31 = and i64 %30, 240
%32 = or i64 %29, %31
%33 = or i64 %32, %27
%34 = sdiv i64 %0, 68719476736
%35 = and i64 %34, 15
%36 = sdiv i64 %0, 1099511627776
%37 = shl i64 %33, 8
%38 = shl nsw i64 %28, 4
%39 = and i64 %38, 240
%40 = or i64 %37, %39
%41 = or i64 %40, %35
%42 = sdiv i64 %0, 17592186044416
%43 = and i64 %42, 15
%44 = sdiv i64 %0, 281474976710656
%45 = shl i64 %41, 8
%46 = shl nsw i64 %36, 4
%47 = and i64 %46, 240
%48 = or i64 %45, %47
%49 = or i64 %48, %43
%50 = sdiv i64 %0, 4503599627370496
%51 = and i64 %50, 15
%52 = sdiv i64 %0, 72057594037927936
%53 = shl i64 %49, 8
%54 = shl nsw i64 %44, 4
%55 = and i64 %54, 240
%56 = or i64 %53, %55
%57 = or i64 %56, %51
%58 = and i64 %52, 15
%59 = shl nsw i64 %57, 4
%60 = or i64 %59, %58
br label %61
61: ; preds = %1, %61
%62 = phi i64 [ %65, %61 ], [ %60, %1 ]
%63 = phi i64 [ %71, %61 ], [ 0, %1 ]
%64 = and i64 %62, 15
%65 = sdiv i64 %62, 16
%66 = icmp ult i64 %64, 10
%67 = or i64 %64, 48
%68 = add nuw nsw i64 %64, 55
%69 = select i1 %66, i64 %67, i64 %68
%70 = tail call i32 @output_char(i64 %69)
%71 = add nuw nsw i64 %63, 1
%72 = icmp eq i64 %71, 15
br i1 %72, label %73, label %61
73: ; preds = %61
ret void
}