// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rdx, -0x50(%rbp)
movq %rsi, %rbx
movq %rdi, %r12
pushq $0x1
popq %rcx
movb $0x1, %al
pushq $0x21
popq %r13
movq %rcx, %r15
movq %rcx, -0x38(%rbp)
testb $0x1, %al
je 0x97508
movq %rbx, %rdi
movq %r13, %rsi
leaq -0x40(%rbp), %rdx
callq 0x13166
movq %rax, %rbx
movq -0x40(%rbp), %r14
movq %r15, %rdi
movq %r13, %rsi
callq 0xffad
movq %r14, %rdi
movq %rax, %rsi
callq 0xdd03
movq %rax, %r15
movq -0x38(%rbp), %rdi
pushq $0x3
popq %rsi
callq 0xdd03
movq %rax, -0x38(%rbp)
movq %rbx, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0x974fb
incl (%rax)
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq 0x89cc
jmp 0x97499
movq %rbx, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0x97538
decl (%rax)
jne 0x97538
movq %rbx, %rdi
leaq 0x70bde(%rip), %rsi     # 0x108111
callq 0xce94
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rdx
setne %al
testb $0x3, %cl
sete %cl
andb %al, %cl
movb %cl, -0x29(%rbp)
cmpb $0x1, %cl
jne 0x97562
addl $0x2, (%rdx)
movq %rdx, -0x48(%rbp)
pushq $0x1
popq %rdi
movq -0x38(%rbp), %r13
movq %r13, %rsi
callq 0x89cc
testb $0x1, %al
je 0x97657
movq %r15, %rdi
pushq $0x21
popq %rsi
leaq -0x40(%rbp), %r14
movq %r14, %rdx
callq 0x13166
movq %rax, %r15
movq -0x40(%rbp), %rdi
callq 0xdc43
movl %eax, %ecx
andl $0xfe, %ecx
leal 0x37(%rax), %edx
addl $0x30, %eax
cmpl $0xa, %ecx
cmovael %edx, %eax
movzbl %al, %edi
callq 0xdbc8
movq %rax, %rdi
callq 0xdc43
movl %eax, %edi
movq %r12, %rsi
movq %r14, %rdx
callq 0x109b9
movq %r13, %rdi
pushq $0x3
popq %rsi
callq 0xe191
movq %rax, %r12
movq %rax, %r14
andq %rbx, %r14
sete %al
testb $0x3, %r12b
setne %bl
orb %al, %bl
jne 0x975f1
incl (%r14)
pushq $0x1
popq %rdi
movq %r12, %rsi
callq 0xdfd4
movq %r12, %r13
testb %al, %al
jne 0x97607
pushq $0x1
popq %r13
orb %al, %bl
jne 0x97623
decl (%r14)
pushq $0x1
popq %r13
jne 0x97623
movq %r12, %rdi
leaq 0x70e0b(%rip), %rsi     # 0x108429
callq 0xce94
movq %r13, %rax
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x97643
incl (%rax)
pushq $0x1
popq %rdi
movq %r13, %rsi
callq 0x89cc
movq -0x40(%rbp), %r12
jmp 0x97575
movq %r13, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x9767e
decl (%rax)
jne 0x9767e
movq %r13, %rdi
leaq 0x70a98(%rip), %rsi     # 0x108111
callq 0xce94
andq %r15, %rbx
sete %al
testb $0x3, %r15b
setne %cl
orb %al, %cl
jne 0x976a2
decl (%rbx)
jne 0x976a2
movq %r15, %rdi
leaq 0x70a74(%rip), %rsi     # 0x108111
callq 0xce94
cmpb $0x0, -0x29(%rbp)
je 0x976c0
movq -0x48(%rbp), %rax
decl (%rax)
jne 0x976c0
movq -0x38(%rbp), %rdi
leaq 0x70a56(%rip), %rsi     # 0x108111
callq 0xce94
movq -0x50(%rbp), %rax
movq %r12, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq