// File: /workspace/github_c_makefile_star2_O1/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, -0x30(%rbp)
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x11c70
movq %rax, %r12
movq (%r15), %rdi
leaq -0x40(%rbp), %r15
movq %r15, %rsi
callq 0x12a76
movq (%r15), %rcx
movq %rcx, 0x18(%r14)
movq 0x10(%r14), %r13
movq (%r13), %r15
movq %rax, %rdi
callq 0xe818
movl %r15d, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x50a0
movslq %r15d, %rbx
cltq
leaq 0x1(,%rax,2), %r12
movl $0x1, %edi
movq %r12, %rsi
callq 0xec04
movl %eax, %r15d
testl %eax, %eax
jle 0x7b377
callq 0x5040
movslq (%rax), %rdi
leaq 0x99d48(%rip), %rsi     # 0x1150b8
callq 0x10ab5
jmp 0x7b386
leaq 0x9a0ab(%rip), %rsi     # 0x115429
movq %r12, %rdi
callq 0x10b13
movq %rdx, %rdi
movq %rbx, (%r13)
testl %r15d, %r15d
jle 0x7b3dd
callq 0x92a2
movq %rax, %r12
movq %rax, %rdi
movq %rdx, %rsi
callq 0x7b0a2
movl $0x1, %edi
movl $0x10, %esi
callq 0x50c0
testq %rax, %rax
je 0x7b5bf
movl $0x1, (%rax)
movq %r12, 0x8(%rax)
btsq $0x32, %rax
leaq 0x9b7f6(%rip), %rsi     # 0x116bc9
movq %rax, %rdi
callq 0x10ab5
jmp 0x7b3ed
callq 0x925b
movq %rax, %rdi
movq %rdx, %rsi
callq 0x10b13
movq %rdx, %rdi
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movq %r13, 0x10(%r14)
testl %r15d, %r15d
jle 0x7b435
callq 0x92a2
testb $0x1, %dl
je 0x7b431
movq %rax, %rcx
andq %rbx, %rcx
sete %sil
testb $0x3, %al
setne %dil
orb %sil, %dil
jne 0x7b431
decl (%rcx)
jne 0x7b431
movq %rax, %rdi
movq %rdx, %rsi
callq 0xd4e3
xorl %edi, %edi
jmp 0x7b448
callq 0x925b
movq %rax, %rdi
movq %rdx, %rsi
callq 0x95f6
movq %rdx, %rdi
testl %r15d, %r15d
jle 0x7b52d
xorl %eax, %eax
xorl %edi, %edi
testb %al, %al
je 0x7b4e8
callq 0xdaeb
movq %rax, %r12
movq %rdx, %r13
movq (%r14), %rdi
leaq 0x99fb7(%rip), %r15     # 0x115429
movq %rdi, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x7b492
decl (%rax)
jne 0x7b492
movq %r15, %rsi
callq 0xd4e3
movq %r12, %rdi
movq %r13, %rsi
callq 0x10db8
movq %r12, (%r14)
movq 0x8(%r14), %rdi
andq %rdi, %rbx
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
jne 0x7b4c1
decl (%rbx)
jne 0x7b4c1
movq %r15, %rsi
callq 0xd4e3
movq $0x1, 0x8(%r14)
movl $0x1, %edi
movl $0x8, %esi
callq 0x50c0
testq %rax, %rax
je 0x7b5c8
movq %r14, (%rax)
xorl %ecx, %ecx
jmp 0x7b511
leaq -0x48(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7b5ed
movq (%r15), %rdi
leaq -0x40(%rbp), %r14
movq %r14, %rsi
callq 0x7b685
movl (%r14), %ecx
movl 0x4(%r14), %edx
movq 0x8(%r14), %rax
movq -0x30(%rbp), %rsi
movl %ecx, (%rsi)
movl %edx, 0x4(%rsi)
movq %rax, 0x8(%rsi)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xdaeb
movq %rax, %r12
movq %rdx, %r15
testb $0x1, %r15b
je 0x7b554
movq %r12, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x7b554
incl (%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x10db8
movl $0x1, %edi
movq %r12, %rsi
callq 0xec04
testl %eax, %eax
js 0x7b5aa
testb $0x1, %r15b
je 0x7b451
movq %r12, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x7b451
decl (%rax)
jne 0x7b451
movq %r12, %rdi
movq %r15, %rsi
callq 0xd4e3
jmp 0x7b451
movq %r12, %rdi
movq %r15, %rsi
callq 0x95f6
movq %rdx, %rdi
movb $0x1, %al
jmp 0x7b455
leaq 0x70c47(%rip), %rsi     # 0xec20d
jmp 0x7b5cf
leaq 0x70c70(%rip), %rsi     # 0xec23f
movl $0x31, %edx
movl $0x2, %edi
callq 0x5060
callq 0x52be
movl $0x1, %edi
callq 0x5130