// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/parse.c
// Function: longstring
static int longstring(JanetParser *p, JanetParseState *state, uint8_t c) {
    if (state->flags & PFLAG_INSTRING) {
        /* We are inside the long string */
        if (c == '`') {
            state->flags |= PFLAG_END_CANDIDATE;
            state->flags &= ~PFLAG_INSTRING;
            state->counter = 1; /* Use counter to keep track of number of '=' seen */
            return 1;
        }
        push_buf(p, c);
        return 1;
    } else if (state->flags & PFLAG_END_CANDIDATE) {
        int i;
        /* We are checking a potential end of the string */
        if (state->counter == state->argn) {
            stringend(p, state);
            return 0;
        }
        if (c == '`' && state->counter < state->argn) {
            state->counter++;
            return 1;
        }
        /* Failed end candidate */
        for (i = 0; i < state->counter; i++) {
            push_buf(p, '`');
        }
        push_buf(p, c);
        state->counter = 0;
        state->flags &= ~PFLAG_END_CANDIDATE;
        state->flags |= PFLAG_INSTRING;
        return 1;
    } else {
        /* We are at beginning of string */
        state->argn++;
        if (c != '`') {
            state->flags |= PFLAG_INSTRING;
            push_buf(p, c);
        }
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x51bce
movzbl -0x19(%rbp), %eax
cmpl $0x60, %eax
jne 0x51bb5
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x200000, %ecx         # imm = 0x200000
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0xffefffff, %ecx       # imm = 0xFFEFFFFF
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x51cdf
movq -0x10(%rbp), %rdi
movzbl -0x19(%rbp), %esi
callq 0x52810
movl $0x1, -0x4(%rbp)
jmp 0x51cdf
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
je 0x51ca5
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x51c0b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x523d0
movl $0x0, -0x4(%rbp)
jmp 0x51cdf
movzbl -0x19(%rbp), %eax
cmpl $0x60, %eax
jne 0x51c3a
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x51c3a
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x51cdf
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x51c65
movq -0x10(%rbp), %rdi
movl $0x60, %esi
callq 0x52810
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x51c41
movq -0x10(%rbp), %rdi
movzbl -0x19(%rbp), %esi
callq 0x52810
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0xffdfffff, %ecx       # imm = 0xFFDFFFFF
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x100000, %ecx         # imm = 0x100000
movl %ecx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x51cdf
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movzbl -0x19(%rbp), %eax
cmpl $0x60, %eax
je 0x51cd8
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x100000, %ecx         # imm = 0x100000
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movzbl -0x19(%rbp), %esi
callq 0x52810
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)