#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*/ __console_tx_nibble(unsigned short);
void __console_tx_hex16(int loglevel, unsigned short value) {
  if (8 > loglevel) {
    __console_tx_nibble((value >> 12U) & 0x0fU);
    __console_tx_nibble((value >> 8U) & 0x0fU);
    __console_tx_nibble((value >> 4U) & 0x0fU);
    __console_tx_nibble(value & 0x0fU);
  }
}


x86 assembly (clang, -O0):
<__console_tx_hex16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    $0x8,%eax
cmp    -0x4(%rbp),%eax
jle    1175 <__console_tx_hex16+0x65>
movzwl -0x6(%rbp),%eax
sar    $0xc,%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <__console_tx_nibble@plt>
movzwl -0x6(%rbp),%eax
sar    $0x8,%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <__console_tx_nibble@plt>
movzwl -0x6(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <__console_tx_nibble@plt>
movzwl -0x6(%rbp),%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <__console_tx_nibble@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__console_tx_hex16>:
cmp    $0x7,%edi
jg     1148 <__console_tx_hex16+0x38>
push   %rbx
mov    %esi,%ebx
movzwl %bx,%edi
shr    $0xc,%edi
call   1030 <__console_tx_nibble@plt>
mov    %ebx,%edi
shr    $0x8,%edi
and    $0xf,%edi
call   1030 <__console_tx_nibble@plt>
mov    %ebx,%edi
shr    $0x4,%edi
and    $0xf,%edi
call   1030 <__console_tx_nibble@plt>
and    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <__console_tx_nibble@plt>
ret

LLVM IR (-O0):
define void @__console_tx_hex16(i32 %0, i16 zeroext %1) {
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
store i16 %1, i16* %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 8, %5
br i1 %6, label %7, label %31
7: ; preds = %2
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
%10 = ashr i32 %9, 12
%11 = and i32 %10, 15
%12 = trunc i32 %11 to i16
%13 = call i32 @__console_tx_nibble(i16 zeroext %12)
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = ashr i32 %15, 8
%17 = and i32 %16, 15
%18 = trunc i32 %17 to i16
%19 = call i32 @__console_tx_nibble(i16 zeroext %18)
%20 = load i16, i16* %4
%21 = zext i16 %20 to i32
%22 = ashr i32 %21, 4
%23 = and i32 %22, 15
%24 = trunc i32 %23 to i16
%25 = call i32 @__console_tx_nibble(i16 zeroext %24)
%26 = load i16, i16* %4
%27 = zext i16 %26 to i32
%28 = and i32 %27, 15
%29 = trunc i32 %28 to i16
%30 = call i32 @__console_tx_nibble(i16 zeroext %29)
br label %31
31: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @__console_tx_hex16(i32 %0, i16 zeroext %1) {
%3 = icmp slt i32 %0, 8
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = lshr i16 %1, 12
%6 = tail call i32 @__console_tx_nibble(i16 zeroext %5)
%7 = lshr i16 %1, 8
%8 = and i16 %7, 15
%9 = tail call i32 @__console_tx_nibble(i16 zeroext %8)
%10 = lshr i16 %1, 4
%11 = and i16 %10, 15
%12 = tail call i32 @__console_tx_nibble(i16 zeroext %11)
%13 = and i16 %1, 15
%14 = tail call i32 @__console_tx_nibble(i16 zeroext %13)
br label %15
15: ; preds = %4, %2
ret void
}