#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*/ fprintf(int /*<<< orphan*/, char *, size_t);
int /*<<< orphan*/ stdout;
void invert_digits(size_t number) {
  fprintf(stdout, "%d", number % 10);
  do {
    fprintf(stdout, "%d", (number / 10) % 10);
    number /= 10;
  } while (number / 10 != 0);
}


x86 assembly (clang, -O0):
<invert_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
lea    0xe99(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rax
jne    113f <invert_digits+0x2f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert_digits>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
mov    0x2ebd(%rip),%r12
mov    (%r12),%edi
movabs $0xcccccccccccccccd,%r13
cc cc cc
mov    %r15,%rax
mul    %r13
shr    $0x2,%rdx
and    $0xfffffffffffffffe,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %r15,%rdx
sub    %rax,%rdx
lea    0xeb0(%rip),%r14
mov    %r14,%rsi
call   1030 <fprintf@plt>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rax
mul    %r13
mov    %rdx,%rbx
mov    (%r12),%edi
shr    $0x3,%rbx
mov    %rbx,%rax
mul    %r13
shr    $0x2,%rdx
and    $0xfffffffffffffffe,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %rbx,%rdx
sub    %rax,%rdx
mov    %r14,%rsi
call   1030 <fprintf@plt>
cmp    $0x63,%r15
mov    %rbx,%r15
ja     1160 <invert_digits+0x50>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [3 x i8] c"%d\00"
define void @invert_digits(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i32, i32* @stdout
%4 = load i64, i64* %2
%5 = urem i64 %4, 10
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %5)
br label %7
7: ; preds = %15, %1
%8 = load i32, i32* @stdout
%9 = load i64, i64* %2
%10 = udiv i64 %9, 10
%11 = urem i64 %10, 10
%12 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = load i64, i64* %2
%14 = udiv i64 %13, 10
store i64 %14, i64* %2
br label %15
15: ; preds = %7
%16 = load i64, i64* %2
%17 = udiv i64 %16, 10
%18 = icmp ne i64 %17, 0
br i1 %18, label %7, label %19
19: ; preds = %15
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%d\00"
define void @invert_digits(i64 %0) {
%2 = load i32, i32* @stdout
%3 = urem i64 %0, 10
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %3)
br label %5
5: ; preds = %5, %1
%6 = phi i64 [ %0, %1 ], [ %8, %5 ]
%7 = load i32, i32* @stdout
%8 = udiv i64 %6, 10
%9 = urem i64 %8, 10
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = icmp ult i64 %6, 100
br i1 %11, label %12, label %5
12: ; preds = %5
ret void
}