// File: joncampbell123[P]haxcc/haxpp.cpp
// Function: parse_sq_char(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>&, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>)
unsigned long long parse_sq_char(string::iterator &li,const string::iterator lie) {
    /* at this point *li == '\'' */
    unsigned long long shf = 0;
    unsigned long long r = 0;
    char c;

    if (li == lie) throw invalid_argument("expected char, got end of line");
    if (*li != '\'') throw invalid_argument("expected char quote, got " + *li);
    li++;

    /* NTS: The reason we loop like this is to support things like 'abcd' to define a 32-bit value
     *      that, when written to memory, spells out 'abcd'. Used in i.e. Microsoft VFW libraries. */
    do {
        if (li == lie) throw invalid_argument("string cut short, expected close quote");
        if (*li == '\'') { li++; break; }
        c = parse_string_char(li,lie);
        r += ((unsigned long long)((unsigned char)c)) << shf;
        shf += 8ull;
    } while (1);

    if (shf > 64ull) fprintf(stderr,"WARNING: char constant too big for compiler storage, truncated");

    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x15b70
testb $0x1, %al
jne 0x6013
jmp 0x6066
movl $0x10, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
leaq 0x1ecf0(%rip), %rsi     # 0x24d1e
callq 0x3530
jmp 0x6035
movq -0x58(%rbp), %rdi
movq 0x2cf98(%rip), %rsi     # 0x32fd8
movq 0x2cf79(%rip), %rdx     # 0x32fc0
callq 0x34b0
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x31f0
jmp 0x61df
movq -0x10(%rbp), %rdi
callq 0x15a50
movsbl (%rax), %eax
cmpl $0x27, %eax
je 0x60dc
movl $0x10, %edi
callq 0x3130
movq %rax, -0x60(%rbp)
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x15a50
movq -0x60(%rbp), %rdi
movsbq (%rax), %rax
leaq 0x1ec9c(%rip), %rsi     # 0x24d3d
addq %rax, %rsi
callq 0x3530
jmp 0x60ab
movq -0x68(%rbp), %rdi
movq 0x2cf22(%rip), %rsi     # 0x32fd8
movq 0x2cf03(%rip), %rdx     # 0x32fc0
callq 0x34b0
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x31f0
jmp 0x61df
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x15a70
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x15b70
testb $0x1, %al
jne 0x60fe
jmp 0x6151
movl $0x10, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
leaq 0x1ec3e(%rip), %rsi     # 0x24d57
callq 0x3530
jmp 0x6120
movq -0x70(%rbp), %rdi
movq 0x2cead(%rip), %rsi     # 0x32fd8
movq 0x2ce8e(%rip), %rdx     # 0x32fc0
callq 0x34b0
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x31f0
jmp 0x61df
movq -0x10(%rbp), %rdi
callq 0x15a50
movsbl (%rax), %eax
cmpl $0x27, %eax
jne 0x6173
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x15a70
movq %rax, -0x48(%rbp)
jmp 0x61b6
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
callq 0x5ee0
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
movq -0x18(%rbp), %rcx
shlq %cl, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x60eb
jmp 0x61b6
cmpq $0x40, -0x18(%rbp)
jbe 0x61d5
movq 0x2cdf4(%rip), %rax     # 0x32fb8
movq (%rax), %rdi
leaq 0x1ebb0(%rip), %rsi     # 0x24d7e
movb $0x0, %al
callq 0x33f0
movq -0x20(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x34e0
nopl (%rax,%rax)