int ansiparm(n)
register int n;
{
  register int q, r;
  q = n / 10;
  if (q != 0) {
    r = q / 10;
    if (r != 0) {
      ttputc((r % 10) + '0');
    }
    ttputc((q % 10) + '0');
  }
  ttputc((n % 10) + '0');
  return 0;
}


x86 assembly (clang, -O0):
<ansiparm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1179 <ansiparm+0x69>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1162 <ansiparm+0x52>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1030 <ttputc@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1030 <ttputc@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1030 <ttputc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ansiparm>:
push   %rbp
push   %rbx
push   %rax
movslq %edi,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rbx
add    %ecx,%ebx
lea    (%rbx,%rbx,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%ebp
sub    %ecx,%ebp
lea    0x9(%rax),%ecx
cmp    $0x13,%ecx
jb     11ae <ansiparm+0x9e>
add    $0x63,%edi
cmp    $0xc7,%edi
jb     1183 <ansiparm+0x73>
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
xor    %eax,%eax
call   1030 <ttputc@plt>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
neg    %eax
lea    (%rbx,%rax,1),%edi
add    $0x30,%edi
xor    %eax,%eax
call   1030 <ttputc@plt>
add    $0x30,%ebp
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <ttputc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ansiparm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 10
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %1
%10 = load i32, i32* %3
%11 = sdiv i32 %10, 10
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i32, i32* %4
%16 = srem i32 %15, 10
%17 = add nsw i32 %16, 48
%18 = call i32 (i32, ...) bitcast (i32 (...)* @ttputc to i32 (i32, ...)*)(i32 %17)
br label %19
19: ; preds = %14, %9
%20 = load i32, i32* %3
%21 = srem i32 %20, 10
%22 = add nsw i32 %21, 48
%23 = call i32 (i32, ...) bitcast (i32 (...)* @ttputc to i32 (i32, ...)*)(i32 %22)
br label %24
24: ; preds = %19, %1
%25 = load i32, i32* %2
%26 = srem i32 %25, 10
%27 = add nsw i32 %26, 48
%28 = call i32 (i32, ...) bitcast (i32 (...)* @ttputc to i32 (i32, ...)*)(i32 %27)
ret i32 0
}

LLVM IR (-O2):
define i32 @ansiparm(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = srem i32 %0, 10
%4 = add i32 %0, 9
%5 = icmp ult i32 %4, 19
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = add i32 %0, 99
%8 = icmp ult i32 %7, 199
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = sdiv i32 %0, 100
%11 = srem i32 %10, 10
%12 = add nsw i32 %11, 48
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @ttputc to i32 (i32, ...)*)(i32 %12)
br label %14
14: ; preds = %9, %6
%15 = srem i32 %2, 10
%16 = add nsw i32 %15, 48
%17 = tail call i32 (i32, ...) bitcast (i32 (...)* @ttputc to i32 (i32, ...)*)(i32 %16)
br label %18
18: ; preds = %14, %1
%19 = add nsw i32 %3, 48
%20 = tail call i32 (i32, ...) bitcast (i32 (...)* @ttputc to i32 (i32, ...)*)(i32 %19)
ret i32 0
}