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

/* Variables and functions */
int /*<<< orphan*/ _ladd(int *, int *);
int /*<<< orphan*/ _llshift(int *);
char _get_digit(uint32_t fract[], int *digit_count) {
  int rval;
  uint32_t temp[2];
  if (*digit_count > 0) {
    *digit_count -= 1;
    temp[0] = fract[0];
    temp[1] = fract[1];
    _llshift(fract);
    _llshift(fract);
    _ladd(fract, temp);
    _llshift(fract);
    rval = ((fract[1] >> 28) & 0xF) + '0';
    fract[1] &= 0x0FFFFFFF;
  } else
    rval = '0';
  return (char)(rval);
}


x86 assembly (clang, -O0):
<_get_digit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11ab <_get_digit+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <_llshift@plt>
mov    -0x8(%rbp),%rdi
call   1040 <_llshift@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <_ladd@plt>
mov    -0x8(%rbp),%rdi
call   1040 <_llshift@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
sar    $0x1c,%eax
and    $0xf,%eax
add    $0x30,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
and    $0xfffffff,%ecx
mov    %ecx,0x4(%rax)
jmp    11b2 <_get_digit+0x92>
movl   $0x30,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_digit>:
push   %rbx
sub    $0x10,%rsp
mov    (%rsi),%eax
test   %eax,%eax
jle    1177 <_get_digit+0x57>
mov    %rdi,%rbx
add    $0xffffffff,%eax
mov    %eax,(%rsi)
mov    (%rdi),%eax
mov    %eax,0x8(%rsp)
mov    0x4(%rdi),%eax
mov    %eax,0xc(%rsp)
call   1040 <_llshift@plt>
mov    %rbx,%rdi
call   1040 <_llshift@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <_ladd@plt>
mov    %rbx,%rdi
call   1040 <_llshift@plt>
mov    0x4(%rbx),%ecx
mov    %ecx,%eax
shr    $0x1c,%eax
and    $0xfffffff,%ecx
mov    %ecx,0x4(%rbx)
or     $0x30,%al
jmp    1179 <_get_digit+0x59>
mov    $0x30,%al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @_get_digit(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [2 x i32]
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %41
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %11
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %16, i32* %17
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 1
%20 = load i32, i32* %19
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %20, i32* %21
%22 = load i32*, i32** %3
%23 = call i32 @_llshift(i32* %22)
%24 = load i32*, i32** %3
%25 = call i32 @_llshift(i32* %24)
%26 = load i32*, i32** %3
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%28 = call i32 @_ladd(i32* %26, i32* %27)
%29 = load i32*, i32** %3
%30 = call i32 @_llshift(i32* %29)
%31 = load i32*, i32** %3
%32 = getelementptr inbounds i32, i32* %31, i64 1
%33 = load i32, i32* %32
%34 = ashr i32 %33, 28
%35 = and i32 %34, 15
%36 = add nsw i32 %35, 48
store i32 %36, i32* %5
%37 = load i32*, i32** %3
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %38
%40 = and i32 %39, 268435455
store i32 %40, i32* %38
br label %42
41: ; preds = %2
store i32 48, i32* %5
br label %42
42: ; preds = %41, %10
%43 = load i32, i32* %5
%44 = trunc i32 %43 to i8
ret i8 %44
}

LLVM IR (-O2):
define signext i8 @_get_digit(i32* %0, i32* nocapture %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %2
%8 = add nsw i32 %5, -1
store i32 %8, i32* %1
%9 = load i32, i32* %0
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %9, i32* %10
%11 = getelementptr inbounds i32, i32* %0, i64 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %12, i32* %13
%14 = tail call i32 @_llshift(i32* %0)
%15 = tail call i32 @_llshift(i32* %0)
%16 = call i32 @_ladd(i32* %0, i32* %10)
%17 = call i32 @_llshift(i32* %0)
%18 = load i32, i32* %11
%19 = lshr i32 %18, 28
%20 = and i32 %18, 268435455
store i32 %20, i32* %11
%21 = trunc i32 %19 to i8
%22 = or i8 %21, 48
br label %23
23: ; preds = %2, %7
%24 = phi i8 [ %22, %7 ], [ 48, %2 ]
ret i8 %24
}