#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*/ adc(int, int);
scalar_t__ beq();
scalar_t__ bne();
int /*<<< orphan*/ clc();
int /*<<< orphan*/ cpx(int /*<<< orphan*/, int);
int /*<<< orphan*/ dex();
int /*<<< orphan*/ div10();
int /*<<< orphan*/ inx();
int /*<<< orphan*/ jsr_inc_pointer();
int /*<<< orphan*/ lda(int, int);
int /*<<< orphan*/ ldx(int /*<<< orphan*/, int);
int /*<<< orphan*/ sta(int, int);
void jsr_num_to_ascii() {
  ldx(0, 0xf3);
  lda(1, 0xf7);
  sta(1, 0xf8);
div_loop:
  div10();
  clc();
  lda(0, 0x30);
  adc(1, 0xfe);
  sta(6, 0);
  dex();
  lda(1, 0xff);
  sta(1, 0xf8);
  if (bne())
    goto div_loop;
store_loop:
  inx();
  lda(6, 0);
  sta(2, 0xfc);
  cpx(0, (0xf3 + 1));
  if (beq())
    goto done_ntoa;
  jsr_inc_pointer();
  goto store_loop;
done_ntoa:;
}


x86 assembly (clang, -O0):
<jsr_num_to_ascii>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0xf3,%esi
call   1060 <ldx@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   10e0 <lda@plt>
mov    $0x1,%edi
mov    $0xf8,%esi
call   1030 <sta@plt>
mov    $0x0,%al
call   10c0 <div10@plt>
mov    $0x0,%al
call   10a0 <clc@plt>
xor    %edi,%edi
mov    $0x30,%esi
call   10e0 <lda@plt>
mov    $0x1,%edi
mov    $0xfe,%esi
call   1090 <adc@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   1030 <sta@plt>
mov    $0x0,%al
call   10d0 <dex@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   10e0 <lda@plt>
mov    $0x1,%edi
mov    $0xf8,%esi
call   1030 <sta@plt>
mov    $0x0,%al
call   1050 <bne@plt>
cmp    $0x0,%rax
je     125e <jsr_num_to_ascii+0x9e>
jmp    11ee <jsr_num_to_ascii+0x2e>
jmp    1263 <jsr_num_to_ascii+0xa3>
mov    $0x0,%al
call   1080 <inx@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   10e0 <lda@plt>
mov    $0x2,%edi
mov    $0xfc,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0xf4,%esi
call   10b0 <cpx@plt>
mov    $0x0,%al
call   1040 <beq@plt>
cmp    $0x0,%rax
je     12a7 <jsr_num_to_ascii+0xe7>
jmp    12b3 <jsr_num_to_ascii+0xf3>
mov    $0x0,%al
call   1070 <jsr_inc_pointer@plt>
jmp    1263 <jsr_num_to_ascii+0xa3>
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsr_num_to_ascii>:
push   %rax
xor    %edi,%edi
mov    $0xf3,%esi
call   1060 <ldx@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   10e0 <lda@plt>
mov    $0x1,%edi
mov    $0xf8,%esi
call   1030 <sta@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <div10@plt>
xor    %eax,%eax
call   10a0 <clc@plt>
xor    %edi,%edi
mov    $0x30,%esi
call   10e0 <lda@plt>
mov    $0x1,%edi
mov    $0xfe,%esi
call   1090 <adc@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   1030 <sta@plt>
xor    %eax,%eax
call   10d0 <dex@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   10e0 <lda@plt>
mov    $0x1,%edi
mov    $0xf8,%esi
call   1030 <sta@plt>
xor    %eax,%eax
call   1050 <bne@plt>
test   %rax,%rax
jne    11f0 <jsr_num_to_ascii+0x30>
jmp    1267 <jsr_num_to_ascii+0xa7>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <jsr_inc_pointer@plt>
xor    %eax,%eax
call   1080 <inx@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   10e0 <lda@plt>
mov    $0x2,%edi
mov    $0xfc,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0xf4,%esi
call   10b0 <cpx@plt>
xor    %eax,%eax
call   1040 <beq@plt>
test   %rax,%rax
je     1260 <jsr_num_to_ascii+0xa0>
pop    %rax
ret

LLVM IR (-O0):
define void @jsr_num_to_ascii() {
%1 = call i32 @ldx(i32 0, i32 243)
%2 = call i32 @lda(i32 1, i32 247)
%3 = call i32 @sta(i32 1, i32 248)
br label %4
4: ; preds = %15, %0
%5 = call i32 (...) @div10()
%6 = call i32 (...) @clc()
%7 = call i32 @lda(i32 0, i32 48)
%8 = call i32 @adc(i32 1, i32 254)
%9 = call i32 @sta(i32 6, i32 0)
%10 = call i32 (...) @dex()
%11 = call i32 @lda(i32 1, i32 255)
%12 = call i32 @sta(i32 1, i32 248)
%13 = call i64 (...) @bne()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %4
br label %4
16: ; preds = %4
br label %17
17: ; preds = %25, %16
%18 = call i32 (...) @inx()
%19 = call i32 @lda(i32 6, i32 0)
%20 = call i32 @sta(i32 2, i32 252)
%21 = call i32 @cpx(i32 0, i32 244)
%22 = call i64 (...) @beq()
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %17
br label %27
25: ; preds = %17
%26 = call i32 (...) @jsr_inc_pointer()
br label %17
27: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @jsr_num_to_ascii() {
%1 = tail call i32 @ldx(i32 0, i32 243)
%2 = tail call i32 @lda(i32 1, i32 247)
%3 = tail call i32 @sta(i32 1, i32 248)
br label %4
4: ; preds = %4, %0
%5 = tail call i32 (...) @div10()
%6 = tail call i32 (...) @clc()
%7 = tail call i32 @lda(i32 0, i32 48)
%8 = tail call i32 @adc(i32 1, i32 254)
%9 = tail call i32 @sta(i32 6, i32 0)
%10 = tail call i32 (...) @dex()
%11 = tail call i32 @lda(i32 1, i32 255)
%12 = tail call i32 @sta(i32 1, i32 248)
%13 = tail call i64 (...) @bne()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4
%16 = tail call i32 (...) @inx()
%17 = tail call i32 @lda(i32 6, i32 0)
%18 = tail call i32 @sta(i32 2, i32 252)
%19 = tail call i32 @cpx(i32 0, i32 244)
%20 = tail call i64 (...) @beq()
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %15, %22
%23 = tail call i32 (...) @jsr_inc_pointer()
%24 = tail call i32 (...) @inx()
%25 = tail call i32 @lda(i32 6, i32 0)
%26 = tail call i32 @sta(i32 2, i32 252)
%27 = tail call i32 @cpx(i32 0, i32 244)
%28 = tail call i64 (...) @beq()
%29 = icmp eq i64 %28, 0
br i1 %29, label %22, label %30
30: ; preds = %22, %15
ret void
}