// File: /workspace/github_c_makefile_star2_O3/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_std_input_zaInputOpenState_refillzebufferzx
static void mw_std_input_zaInputOpenState_refillzebufferzx (struct std_input_zaInputOpenState* in_zaInputOpenState_1, struct std_input_zaInput *out_zaInput_2) {
	ARR* r3 = in_zaInputOpenState_1->mzabuffer;
	ARR* v4;
	void* v5 = mw_std_buffer_zaBuffer_base(r3, &v4);
	ARR* v6;
	INT v7 = mw_std_buffer_zaBuffer_sizze(v4, &v6);
	in_zaInputOpenState_1->mzabuffer = v6;
	struct std_file_zaFile* r8 = in_zaInputOpenState_1->mzafile;
	struct std_file_zaFile* v9;
	struct std_result_Result_2 v10 = mw_std_file_zaFile_readzebyteszx(r8, v5, v7, &v9);
	in_zaInputOpenState_1->mzafile = v9;
	struct std_maybe_Maybe_1 v11 = mw_std_result_Result_2_okzy(v10);
	struct std_maybe_Maybe_1 branch_Maybe_12;
	switch ((v11).tag) {
		case std_maybe_Maybe_1_Some: {
			VAL v13 = mtp_std_maybe_Maybe_1_Some(v11);
			incref(v13);
			INT v14 = WRAP_I63(0LL);
			INT v15 = v14;
			bool v16 = int_lt(v15, value_int(v13));
			struct std_maybe_Maybe_1 branch_Maybe_17;
			if (v16) {
				struct std_maybe_Maybe_1 v18 = mtw_std_maybe_Maybe_1_Some(v13);
				branch_Maybe_17 = v18;
			} else {
				decref(v13);
				struct std_maybe_Maybe_1 v19 = { .tag=std_maybe_Maybe_1_None };
				branch_Maybe_17 = v19;
			}
			branch_Maybe_12 = branch_Maybe_17;
		} break;
		case std_maybe_Maybe_1_None: {
			struct std_maybe_Maybe_1 v20 = { .tag=std_maybe_Maybe_1_None };
			branch_Maybe_12 = v20;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	struct std_input_zaInput branch_zaInput_21;
	switch ((branch_Maybe_12).tag) {
		case std_maybe_Maybe_1_Some: {
			VAL v22 = mtp_std_maybe_Maybe_1_Some(branch_Maybe_12);
			INT v23 = in_zaInputOpenState_1->mlength;
			decref(MKINT(v23));
			in_zaInputOpenState_1->mlength = value_int(v22);
			INT v24 = WRAP_I63(0LL);
			INT v25 = in_zaInputOpenState_1->moffset;
			decref(MKINT(v25));
			in_zaInputOpenState_1->moffset = v24;
			struct std_input_zaInput v26;
			mtw_std_input_zaInput_Open(in_zaInputOpenState_1, &v26);
			branch_zaInput_21 = v26;
		} break;
		case std_maybe_Maybe_1_None: {
			struct std_file_zaFile* v27;
			mw_std_input_zaInputOpenState_endzx(in_zaInputOpenState_1, &v27);
			struct std_input_zaInput v28;
			mtw_std_input_zaInput_Done(v27, &v28);
			branch_zaInput_21 = v28;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_zaInput_2 = branch_zaInput_21;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x11814
movq %rax, %r12
movq (%r15), %rdi
leaq -0x40(%rbp), %r15
movq %r15, %rsi
callq 0x126ce
movq (%r15), %rcx
movq %rcx, 0x18(%r14)
movq 0x10(%r14), %r13
movq (%r13), %r15
movq %rax, %rdi
callq 0xe445
movl %r15d, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x50a0
movslq %r15d, %r15
cltq
leaq 0x1(,%rax,2), %r12
movl $0x1, %edi
movq %r12, %rsi
callq 0xe83a
testl %eax, %eax
jle 0x79521
callq 0x5040
movslq (%rax), %rdi
leaq 0x97c34(%rip), %rsi     # 0x1110b8
callq 0x10694
movq %rdx, %rdi
movq %r15, (%r13)
callq 0x8ff9
movq %rax, %r15
movq %rax, %rdi
movq %rdx, %rsi
callq 0x791b0
movl $0x1, %edi
movl $0x10, %esi
callq 0x50c0
testq %rax, %rax
je 0x796c1
movl $0x1, (%rax)
movq %r15, 0x8(%rax)
btsq $0x32, %rax
leaq 0x996f8(%rip), %rsi     # 0x112bc9
movq %rax, %rdi
callq 0x10694
movq %rdx, %rdi
movq %r13, 0x10(%r14)
callq 0x8ff9
testb $0x1, %dl
je 0x795e2
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rax, %rcx
sete %sil
testb $0x3, %al
setne %dil
orb %sil, %dil
jne 0x795e2
decl (%rcx)
jne 0x795e2
movq %rax, %rdi
movq %rdx, %rsi
jmp 0x795dd
movq %rbx, -0x30(%rbp)
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
leaq 0x97ef3(%rip), %rsi     # 0x111429
movq %r12, %rdi
callq 0x106f2
movq %rdx, %rdi
movq %r15, (%r13)
movq %rbx, %r15
callq 0x8fb2
movq %rax, %rdi
movq %rdx, %rsi
callq 0x106f2
movq %rdx, %rdi
movq %r13, 0x10(%r14)
callq 0x8fb2
movq %rax, %rdi
movq %rdx, %rsi
callq 0x9353
movq %rdx, %rdi
callq 0xd745
movq %rax, %r13
movq %rdx, %r12
testb $0x1, %r12b
je 0x79599
movq %r13, %rax
andq %r15, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x79599
incl (%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x1099d
movl $0x1, %edi
movq %r13, %rsi
callq 0xe83a
testl %eax, %eax
js 0x79623
testb $0x1, %r12b
movq -0x30(%rbp), %rbx
je 0x795e2
movq %r13, %rax
andq %r15, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x795e2
decl (%rax)
jne 0x795e2
movq %r13, %rdi
movq %r12, %rsi
callq 0xd13d
leaq -0x48(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x796ef
movq (%r15), %rdi
leaq -0x40(%rbp), %r14
movq %r14, %rsi
callq 0x79787
movl (%r14), %ecx
movl 0x4(%r14), %edx
movq 0x8(%r14), %rax
movl %ecx, (%rbx)
movl %edx, 0x4(%rbx)
movq %rax, 0x8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
movq %r12, %rsi
callq 0x9353
movq %rdx, %rdi
callq 0xd745
movq %rax, %r12
movq %rdx, %r13
movq (%r14), %rdi
movq %rdi, %rax
andq %r15, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x79663
decl (%rax)
jne 0x79663
leaq 0x97dcb(%rip), %rsi     # 0x111429
callq 0xd13d
movq %r12, %rdi
movq %r13, %rsi
callq 0x1099d
movq %r12, (%r14)
movq 0x8(%r14), %rdi
andq %rdi, %r15
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
movq -0x30(%rbp), %rbx
jne 0x7969b
decl (%r15)
jne 0x7969b
leaq 0x97d93(%rip), %rsi     # 0x111429
callq 0xd13d
movq $0x1, 0x8(%r14)
movl $0x1, %edi
movl $0x8, %esi
callq 0x50c0
testq %rax, %rax
je 0x796e6
movq %r14, (%rax)
xorl %ecx, %ecx
jmp 0x7960b
leaq 0x6ea14(%rip), %rsi     # 0xe80dc
movl $0x31, %edx
movl $0x2, %edi
callq 0x5060
callq 0x52b6
movl $0x1, %edi
callq 0x5130
leaq 0x6ea21(%rip), %rsi     # 0xe810e
jmp 0x796c8