#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ rem;
  int /*<<< orphan*/ quot;
};
typedef TYPE_1__ div_t;

/* Variables and functions */
TYPE_1__ div(int, int);
void __print_lz(int i, char *buffer, char s) {
  div_t result;
  result = div(i, 10);
  *buffer++ = result.quot + '0';
  *buffer++ = result.rem + '0';
  *buffer = s;
}


x86 assembly (clang, -O0):
<__print_lz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xa,%esi
call   1030 <div@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__print_lz>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    $0xa,%esi
call   1030 <div@plt>
lea    0x30(%rax),%ecx
shr    $0x20,%rax
add    $0x30,%al
mov    %al,(%rbx)
mov    %cl,0x1(%rbx)
mov    %bpl,0x2(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
define void @__print_lz(i32 %0, i8* %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8
%7 = alloca %struct.TYPE_3__
%8 = alloca %struct.TYPE_3__
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%9 = load i32, i32* %4
%10 = call i64 @div(i32 %9, i32 10)
%11 = bitcast %struct.TYPE_3__* %8 to i64*
store i64 %10, i64* %11
%12 = bitcast %struct.TYPE_3__* %7 to i8*
%13 = bitcast %struct.TYPE_3__* %8 to i8*
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 1
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 48
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
store i8 %17, i8* %18
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 48
%23 = trunc i32 %22 to i8
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
store i8 %23, i8* %24
%26 = load i8, i8* %6
%27 = load i8*, i8** %5
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @__print_lz(i32 %0, i8* nocapture writeonly %1, i8 signext %2) {
%4 = tail call i64 @div(i32 %0, i32 10)
%5 = trunc i64 %4 to i8
%6 = lshr i64 %4, 32
%7 = trunc i64 %6 to i8
%8 = add i8 %7, 48
%9 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %8, i8* %1
%10 = add i8 %5, 48
%11 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %10, i8* %9
store i8 %2, i8* %11
ret void
}