#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 uint8_t;

/* Variables and functions */
void hazer_checksum2characters(uint8_t ck, uint8_t *msnp, uint8_t *lsnp) {
  uint8_t msn = 0;
  uint8_t lsn = 0;
  msn = ck >> 4;
  if ((0x0 <= msn) && (msn <= 0x9)) {
    *msnp = '0' + msn;
  } else if ((0xa <= msn) && (msn <= 0xf)) {
    *msnp = 'A' + msn - 10;
  } else {
  }
  lsn = ck & 0xf;
  if ((0x0 <= lsn) && (lsn <= 0x9)) {
    *lsnp = '0' + lsn;
  } else if ((0xa <= lsn) && (lsn <= 0xf)) {
    *lsnp = 'A' + lsn - 10;
  } else {
  }
}


x86 assembly (clang, -O0):
<hazer_checksum2characters>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmp    -0x1c(%rbp),%eax
jg     114c <hazer_checksum2characters+0x4c>
cmpl   $0x9,-0x1c(%rbp)
jg     114c <hazer_checksum2characters+0x4c>
mov    -0x1c(%rbp),%ecx
add    $0x30,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1182 <hazer_checksum2characters+0x82>
mov    $0xa,%eax
cmp    -0x1c(%rbp),%eax
jg     1178 <hazer_checksum2characters+0x78>
cmpl   $0xf,-0x1c(%rbp)
jg     1178 <hazer_checksum2characters+0x78>
mov    -0x1c(%rbp),%ecx
add    $0x41,%ecx
sub    $0xa,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    117d <hazer_checksum2characters+0x7d>
jmp    117d <hazer_checksum2characters+0x7d>
jmp    1182 <hazer_checksum2characters+0x82>
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%eax
jg     11b1 <hazer_checksum2characters+0xb1>
cmpl   $0x9,-0x20(%rbp)
jg     11b1 <hazer_checksum2characters+0xb1>
mov    -0x20(%rbp),%ecx
add    $0x30,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11e7 <hazer_checksum2characters+0xe7>
mov    $0xa,%eax
cmp    -0x20(%rbp),%eax
jg     11dd <hazer_checksum2characters+0xdd>
cmpl   $0xf,-0x20(%rbp)
jg     11dd <hazer_checksum2characters+0xdd>
mov    -0x20(%rbp),%ecx
add    $0x41,%ecx
sub    $0xa,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11e2 <hazer_checksum2characters+0xe2>
jmp    11e2 <hazer_checksum2characters+0xe2>
jmp    11e7 <hazer_checksum2characters+0xe7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hazer_checksum2characters>:
mov    $0x30,%eax
cmp    $0xa0,%edi
jb     111d <hazer_checksum2characters+0x1d>
lea    -0xa0(%rdi),%ecx
mov    $0x37,%eax
cmp    $0x5f,%ecx
ja     1126 <hazer_checksum2characters+0x26>
mov    %edi,%ecx
sar    $0x4,%ecx
add    %eax,%ecx
mov    %ecx,(%rsi)
and    $0xf,%edi
lea    0x37(%rdi),%eax
lea    0x30(%rdi),%ecx
cmp    $0xa,%edi
cmovae %eax,%ecx
mov    %ecx,(%rdx)
ret

LLVM IR (-O0):
define void @hazer_checksum2characters(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = ashr i32 %9, 4
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp sle i32 0, %11
br i1 %12, label %13, label %20
13: ; preds = %3
%14 = load i32, i32* %7
%15 = icmp sle i32 %14, 9
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %7
%18 = add nsw i32 48, %17
%19 = load i32*, i32** %5
store i32 %18, i32* %19
br label %33
20: ; preds = %13, %3
%21 = load i32, i32* %7
%22 = icmp sle i32 10, %21
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i32, i32* %7
%25 = icmp sle i32 %24, 15
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %7
%28 = add nsw i32 65, %27
%29 = sub nsw i32 %28, 10
%30 = load i32*, i32** %5
store i32 %29, i32* %30
br label %32
31: ; preds = %23, %20
br label %32
32: ; preds = %31, %26
br label %33
33: ; preds = %32, %16
%34 = load i32, i32* %4
%35 = and i32 %34, 15
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = icmp sle i32 0, %36
br i1 %37, label %38, label %45
38: ; preds = %33
%39 = load i32, i32* %8
%40 = icmp sle i32 %39, 9
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = load i32, i32* %8
%43 = add nsw i32 48, %42
%44 = load i32*, i32** %6
store i32 %43, i32* %44
br label %58
45: ; preds = %38, %33
%46 = load i32, i32* %8
%47 = icmp sle i32 10, %46
br i1 %47, label %48, label %56
48: ; preds = %45
%49 = load i32, i32* %8
%50 = icmp sle i32 %49, 15
br i1 %50, label %51, label %56
51: ; preds = %48
%52 = load i32, i32* %8
%53 = add nsw i32 65, %52
%54 = sub nsw i32 %53, 10
%55 = load i32*, i32** %6
store i32 %54, i32* %55
br label %57
56: ; preds = %48, %45
br label %57
57: ; preds = %56, %51
br label %58
58: ; preds = %57, %41
ret void
}

LLVM IR (-O2):
define void @hazer_checksum2characters(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = ashr i32 %0, 4
%5 = icmp ult i32 %0, 160
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = add i32 %0, -160
%8 = icmp ult i32 %7, 96
br i1 %8, label %9, label %12
9: ; preds = %6, %3
%10 = phi i32 [ 48, %3 ], [ 55, %6 ]
%11 = add nsw i32 %4, %10
store i32 %11, i32* %1
br label %12
12: ; preds = %9, %6
%13 = and i32 %0, 15
%14 = icmp ult i32 %13, 10
%15 = add nuw nsw i32 %13, 55
%16 = or i32 %13, 48
%17 = select i1 %14, i32 %16, i32 %15
store i32 %17, i32* %2
ret void
}