// File: /workspace/github_c_makefile_star2_O3/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, -0x60(%rbp)
movq %rsi, %rbx
movq %rdi, -0x40(%rbp)
movl $0x1, %eax
movq %rax, -0x38(%rbp)
leaq -0x48(%rbp), %r15
movl $0x1, %r12d
movl $0x21, %esi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x13e71
movq %rax, %rbx
movq -0x48(%rbp), %r13
movl $0x21, %esi
movq %r12, %rdi
callq 0x109ee
movq %r13, %rdi
movq %rax, %rsi
callq 0xe50f
movq %rax, %r12
movl $0x3, %esi
movq -0x38(%rbp), %rdi
callq 0xe50f
movq %rax, -0x38(%rbp)
movq %rbx, %r14
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %r14
sete %al
testb $0x3, %bl
setne %cl
orb %al, %cl
jne 0x9fe33
incl (%r14)
movl $0x1, %edi
movq %rbx, %rsi
callq 0xe83a
testl %eax, %eax
js 0x9fdbc
jmp 0x9fe51
movl $0x1, %edi
movq %rbx, %rsi
callq 0xe83a
testl %eax, %eax
js 0x9fdbc
leaq 0x712c2(%rip), %r13     # 0x111111
jmp 0x9fe68
leaq 0x712b9(%rip), %r13     # 0x111111
decl (%r14)
jne 0x9fe68
movq %rbx, %rdi
movq %r13, %rsi
callq 0xd13d
movq -0x38(%rbp), %r15
movq %r15, %r14
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %r14
setne %al
testb $0x3, %r15b
sete %cl
andb %al, %cl
movb %cl, -0x29(%rbp)
cmpb $0x1, %cl
jne 0x9fe94
addl $0x2, (%r14)
movl $0x1, %edi
movq %r15, %rsi
callq 0xe83a
testl %eax, %eax
movq %r14, -0x58(%rbp)
js 0x9feb4
movq %r14, %rax
movq %r15, %r14
jmp 0x9ffc7
movq %r13, -0x50(%rbp)
leaq -0x48(%rbp), %rbx
movq %r15, %r14
movl $0x21, %esi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x13e71
movq %rax, %r12
movq -0x48(%rbp), %rdi
callq 0xe445
movl %eax, %ecx
andl $0xfe, %ecx
leal 0x37(%rax), %edx
addl $0x30, %eax
cmpl $0xa, %ecx
cmovael %edx, %eax
movzbl %al, %edi
callq 0xe3d6
movq %rax, %rdi
callq 0xe445
movl %eax, %edi
callq 0x1147d
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0xe069
movq %rax, -0x40(%rbp)
movl $0x3, %esi
movq %r14, %rdi
callq 0xe9fc
movq %rax, %r13
movq %rax, %r15
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %r15
sete %al
testb $0x3, %r13b
setne %cl
orb %al, %cl
jne 0x9ff79
incl (%r15)
movl $0x1, %edi
movq %r13, %rsi
callq 0xe83a
movl (%r15), %ecx
testl %eax, %eax
jle 0x9ff92
movl $0x1, %r14d
decl %ecx
movl %ecx, (%r15)
jne 0x9ff9a
movq %r13, %rdi
leaq 0x714b7(%rip), %rsi     # 0x111429
callq 0xd13d
jmp 0x9ff9a
movl $0x1, %edi
movq %r13, %rsi
callq 0xe83a
testl %eax, %eax
jle 0x9ff97
movl $0x1, %r13d
jmp 0x9ff97
incl %ecx
movl %ecx, (%r15)
movq %r13, %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0xe83a
testl %eax, %eax
js 0x9febf
movq %r14, %rax
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rax
movq -0x38(%rbp), %r15
movq -0x50(%rbp), %r13
testq %rax, %rax
sete %cl
testb $0x3, %r14b
setne %dl
orb %cl, %dl
jne 0x9ffe7
decl (%rax)
jne 0x9ffe7
movq %r14, %rdi
movq %r13, %rsi
callq 0xd13d
andq %r12, %rbx
sete %al
testb $0x3, %r12b
setne %cl
orb %al, %cl
jne 0xa0007
decl (%rbx)
jne 0xa0007
movq %r12, %rdi
movq %r13, %rsi
callq 0xd13d
cmpb $0x0, -0x29(%rbp)
movq -0x58(%rbp), %rax
je 0xa0020
decl (%rax)
jne 0xa0020
movq %r15, %rdi
movq %r13, %rsi
callq 0xd13d
movq -0x60(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq