#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*/ printf(char *, unsigned char, unsigned char);
int /*<<< orphan*/ putchar(char);
void pr(unsigned char *bcd) {
  int i;
  for (i = 9; i >= 0; --i)
    printf("%d%d", bcd[i] >> 4 & 0xf, bcd[i] & 0xf);
  putchar('\n');
}


x86 assembly (clang, -O0):
<pr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x9,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1180 <pr+0x60>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
sar    $0x4,%eax
and    $0xf,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rdx
movzbl (%rax,%rdx,1),%eax
and    $0xf,%eax
lea    0xe99(%rip),%rdi
movzbl %cl,%esi
movzbl %al,%edx
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <pr+0x13>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl 0x9(%rdi),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
lea    0xec3(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x8(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x7(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x6(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x5(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x4(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x3(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x2(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x1(%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl (%rbx),%edx
mov    %edx,%eax
shr    $0x4,%al
and    $0xf,%edx
movzbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
define void @pr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 9, i32* %3
br label %4
4: ; preds = %26, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %29
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = ashr i32 %13, 4
%15 = and i32 %14, 15
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = and i32 %22, 15
%24 = trunc i32 %23 to i8
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %16, i8 zeroext %24)
br label %26
26: ; preds = %7
%27 = load i32, i32* %3
%28 = add nsw i32 %27, -1
store i32 %28, i32* %3
br label %4
29: ; preds = %4
%30 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
define void @pr(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 9
%3 = load i8, i8* %2
%4 = lshr i8 %3, 4
%5 = and i8 %3, 15
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %4, i8 zeroext %5)
%7 = getelementptr inbounds i8, i8* %0, i64 8
%8 = load i8, i8* %7
%9 = lshr i8 %8, 4
%10 = and i8 %8, 15
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %9, i8 zeroext %10)
%12 = getelementptr inbounds i8, i8* %0, i64 7
%13 = load i8, i8* %12
%14 = lshr i8 %13, 4
%15 = and i8 %13, 15
%16 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %14, i8 zeroext %15)
%17 = getelementptr inbounds i8, i8* %0, i64 6
%18 = load i8, i8* %17
%19 = lshr i8 %18, 4
%20 = and i8 %18, 15
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %19, i8 zeroext %20)
%22 = getelementptr inbounds i8, i8* %0, i64 5
%23 = load i8, i8* %22
%24 = lshr i8 %23, 4
%25 = and i8 %23, 15
%26 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %24, i8 zeroext %25)
%27 = getelementptr inbounds i8, i8* %0, i64 4
%28 = load i8, i8* %27
%29 = lshr i8 %28, 4
%30 = and i8 %28, 15
%31 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %29, i8 zeroext %30)
%32 = getelementptr inbounds i8, i8* %0, i64 3
%33 = load i8, i8* %32
%34 = lshr i8 %33, 4
%35 = and i8 %33, 15
%36 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %34, i8 zeroext %35)
%37 = getelementptr inbounds i8, i8* %0, i64 2
%38 = load i8, i8* %37
%39 = lshr i8 %38, 4
%40 = and i8 %38, 15
%41 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %39, i8 zeroext %40)
%42 = getelementptr inbounds i8, i8* %0, i64 1
%43 = load i8, i8* %42
%44 = lshr i8 %43, 4
%45 = and i8 %43, 15
%46 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %44, i8 zeroext %45)
%47 = load i8, i8* %0
%48 = lshr i8 %47, 4
%49 = and i8 %47, 15
%50 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %48, i8 zeroext %49)
%51 = tail call i32 @putchar(i8 signext 10)
ret void
}