// File: /workspace/github_c_makefile_star2_O1/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_std_number_Base_digitszj
static void mw_std_number_Base_digitszj (STR* in_zaStr_1, INT in_Nat_2, INT in_Base_3, STR* *out_zaStr_4) {
	INT v5 = WRAP_I63(0LL);
	INT v6 = WRAP_I63(0LL);
	bool v7 = true;
	INT v8 = v5;
	INT v9 = v6;
	INT v10 = in_Nat_2;
	INT v11 = in_Base_3;
	bool v12 = v7;
	bool v13 = v7;
	while (v13) {
		INT v14 = v8;
		INT v15 = v9;
		INT v16 = v10;
		INT v17 = v11;
		bool v18 = v12;
		incref(MKNAT(v17));
		INT v19 = v16;
		INT v20 = v17;
		INT v21;
		INT v22 = int_divmod(v19, v20, &v21);
		INT v23 = v21;
		INT v24 = v22;
		incref(MKNAT(v17));
		INT v25 = v15;
		INT v26 = v17;
		INT v27 = int_mul(v25, v26);
		INT v28 = v27;
		INT v29 = v23;
		INT v30 = v28;
		INT v31 = int_add(v29, v30);
		INT v32 = v31;
		INT v33 = WRAP_I63(1LL);
		INT v34 = v14;
		INT v35 = v33;
		INT v36 = int_add(v34, v35);
		INT v37 = v36;
		incref(MKNAT(v24));
		INT v38 = WRAP_I63(0LL);
		INT v39 = v24;
		INT v40 = v38;
		bool v41 = int_lt(v40, v39);
		v13 = v41;
		v12 = v41;
		v11 = v17;
		v10 = v24;
		v9 = v32;
		v8 = v37;
	}
	decref(MKNAT(v10));
	incref(MKNAT(v8));
	incref(MKNAT(v8));
	INT v42 = WRAP_I63(0LL);
	INT v43 = v8;
	INT v44 = v42;
	bool v45 = int_lt(v44, v43);
	STR* r46 = in_zaStr_1;
	INT v47 = v11;
	INT v48 = v9;
	INT v49 = v8;
	bool v50 = v45;
	while (v50) {
		STR* r51 = r46;
		INT v52 = v47;
		INT v53 = v48;
		INT v54 = v49;
		incref(MKNAT(v52));
		enum std_byte_Byte v55;
		INT v56 = mw_std_number_Base_lastzedigit(v53, v52, &v55);
		STR* v57;
		mw_std_str_zaStr_pushzebytezeunsafezx(v55, r51, &v57);
		INT v58 = WRAP_I63(1LL);
		INT v59 = v54;
		INT v60 = v58;
		INT v61 = int_sub(v59, v60);
		incref(MKINT(v61));
		INT v62 = WRAP_I63(0LL);
		INT v63 = v62;
		bool v64 = int_le(v63, v61);
		INT branch_Nat_65;
		if (v64) {
			INT v66 = v61;
			branch_Nat_65 = v66;
		} else {
			decref(MKINT(v61));
			INT v67 = WRAP_I63(0LL);
			branch_Nat_65 = v67;
		}
		incref(MKNAT(branch_Nat_65));
		INT v68 = WRAP_I63(0LL);
		INT v69 = branch_Nat_65;
		INT v70 = v68;
		bool v71 = int_lt(v70, v69);
		v50 = v71;
		v49 = branch_Nat_65;
		v48 = v56;
		v47 = v52;
		r46 = v57;
	}
	decref(MKNAT(v49));
	decref(MKNAT(v48));
	decref(MKNAT(v8));
	decref(MKNAT(v47));
	*out_zaStr_4 = r46;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, -0x50(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %r12d
leaq -0x40(%rbp), %r15
movl $0x1, %eax
movq %rax, -0x38(%rbp)
movl $0x21, %esi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x141df
movq %rax, %rbx
movq -0x40(%rbp), %r13
movl $0x21, %esi
movq -0x38(%rbp), %rdi
callq 0x10e09
movq %r13, %rdi
movq %rax, %rsi
callq 0xe8e2
movq %rax, -0x38(%rbp)
movl $0x3, %esi
movq %r12, %rdi
callq 0xe8e2
movq %rax, %r12
movq %rbx, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0xa28af
incl (%rax)
movl $0x1, %edi
movq %rbx, %rsi
callq 0xec04
testl %eax, %eax
js 0xa284c
movq %rbx, %rax
movabsq $0xfffffffffffc, %r15   # imm = 0xFFFFFFFFFFFC
andq %r15, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0xa28f0
decl (%rax)
jne 0xa28f0
movq %rbx, %rdi
leaq 0x72826(%rip), %rsi     # 0x115111
callq 0xd4e3
movq %r12, %rcx
andq %r15, %rcx
setne %al
testb $0x3, %r12b
sete %dl
andb %al, %dl
movb %dl, -0x29(%rbp)
cmpb $0x1, %dl
jne 0xa290d
addl $0x2, (%rcx)
movq %rcx, -0x48(%rbp)
movl $0x1, %edi
movq %r12, %rsi
callq 0xec04
movq %r12, %r13
testl %eax, %eax
jns 0xa2a2e
movq %r12, -0x58(%rbp)
movl $0x21, %esi
movq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x141df
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rdi
callq 0xe818
movl %eax, %ecx
andl $0xfe, %ecx
leal 0x37(%rax), %edx
addl $0x30, %eax
cmpl $0xa, %ecx
cmovael %edx, %eax
movzbl %al, %edi
callq 0xe7a9
movq %rax, %rdi
callq 0xe818
movl %eax, %edi
callq 0x11871
movq %r14, %rdi
movq %rax, %rsi
callq 0xe43c
movq %rax, %r12
movl $0x3, %esi
movq %r13, %rdi
callq 0xedca
movq %rax, %r15
movq %rax, %rbx
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %rbx
sete %al
testb $0x3, %r15b
setne %r14b
orb %al, %r14b
jne 0xa29b7
incl (%rbx)
movl $0x1, %edi
movq %r15, %rsi
callq 0xec04
movq %r15, %r13
testl %eax, %eax
setle %al
jle 0xa29d4
movl $0x1, %r13d
orb %al, %r14b
movq %r12, %r14
movq -0x58(%rbp), %r12
jne 0xa29f9
decl (%rbx)
movl $0x1, %r13d
jne 0xa29f9
movq %r15, %rdi
leaq 0x72a35(%rip), %rsi     # 0x115429
callq 0xd4e3
movq %r13, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0xa2a19
incl (%rax)
movl $0x1, %edi
movq %r13, %rsi
callq 0xec04
testl %eax, %eax
js 0xa292d
movq %r13, %rax
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0xa2a5f
decl (%rax)
jne 0xa2a5f
movq %r13, %rdi
leaq 0x726b7(%rip), %rsi     # 0x115111
callq 0xd4e3
movq -0x38(%rbp), %rdi
andq %rdi, %rbx
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
jne 0xa2a84
decl (%rbx)
jne 0xa2a84
leaq 0x72692(%rip), %rsi     # 0x115111
callq 0xd4e3
cmpb $0x0, -0x29(%rbp)
je 0xa2aa1
movq -0x48(%rbp), %rax
decl (%rax)
jne 0xa2aa1
movq %r12, %rdi
leaq 0x72675(%rip), %rsi     # 0x115111
callq 0xd4e3
movq -0x50(%rbp), %rax
movq %r14, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq