// File: /workspace/github_c_makefile_star2_O0/naleksiev[P]fin/src/fin_lex.c
// Function: fin_lex_create_string_token
static fin_lex_token_t fin_lex_create_string_token(fin_lex_t* lex) {
    const char* start = lex->cstr;
    char c;
    while ((c = *lex->cstr++) != '\0') {
        switch (c) {
            case '{': {
                if (lex->cstr - start > 1) {
                    lex->cstr--;
                    fin_lex_token_t token;
                    token.type = fin_lex_type_string;
                    token.cstr = start;
                    token.line = lex->line;
                    token.len = (int32_t)(lex->cstr - start);
                    return token;
                }
                fin_lex_state_t* state = &lex->states[++lex->state_idx];
                state->type = fin_lex_state_type_interp;
                state->cstr = lex->cstr;
                return fin_lex_create_token(lex, fin_lex_type_l_str_interp);
            }
            case '"': {
                if (lex->cstr - start > 1) {
                    lex->cstr--;
                    fin_lex_token_t token;
                    token.type = fin_lex_type_string;
                    token.cstr = start;
                    token.line = lex->line;
                    token.len = (int32_t)(lex->cstr - start);
                    return token;
                }
                lex->state_idx--;
                return fin_lex_create_token(lex, fin_lex_type_quot);
            }
        }
    }
    fin_lex_error(lex, "Unterminated string.");
    return fin_lex_create_token(lex, fin_lex_type_error);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x30(%rbp)
movq %rdi, -0x28(%rbp)
movq %rsi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, (%rcx)
movb (%rax), %al
movb %al, -0x11(%rbp)
movsbl %al, %eax
cmpl $0x0, %eax
je 0x704b
movsbl -0x11(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0x22, %eax
je 0x6fce
jmp 0x6f13
movl -0x34(%rbp), %eax
subl $0x7b, %eax
jne 0x7046
jmp 0x6f21
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jle 0x6f75
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdx
addq $-0x1, %rdx
movq %rdx, (%rcx)
movl $0x3, (%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
subq %rdx, %rcx
movl %ecx, 0x10(%rax)
jmp 0x706f
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq -0x8(%rbp), %rdx
movl 0x128(%rdx), %ecx
addl $0x1, %ecx
movl %ecx, 0x128(%rdx)
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rsi
movl $0x6, %edx
callq 0x7080
jmp 0x706f
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jle 0x701f
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdx
addq $-0x1, %rdx
movq %rdx, (%rcx)
movl $0x3, (%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
subq %rdx, %rcx
movl %ecx, 0x10(%rax)
jmp 0x706f
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x128(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x128(%rax)
movq -0x8(%rbp), %rsi
movl $0x5, %edx
callq 0x7080
jmp 0x706f
jmp 0x6edf
movq -0x8(%rbp), %rdi
leaq 0x64b6(%rip), %rsi      # 0xd50c
movb $0x0, %al
callq 0x74a0
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x40, %edx
callq 0x7080
movq -0x28(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)