// File: /workspace/github_c_makefile_star2_O3/wjmelements[P]evm/src/scan.c
// Function: parseDecimal
op_t parseDecimal(const char **iter, int negative) {
    uint64_t words[4] = {0,0,0,0};
    while (isDecimal(**iter)) {
        // multiply number by 10
        for (uint8_t i = 4; i --> 0;) {
            // long multiplication
            uint64_t s0, s1, s2, s3;

            uint64_t x = lo32(words[i]) * 10;
            s0 = lo32(x);

            x = hi32(words[i]) * 10 + hi32(x);
            s1 = lo32(x);
            s2 = hi32(x);

            x = s1;
            s1 = lo32(x);

            x = s2 + hi32(x);
            s2 = lo32(x);
            s3 = hi32(x);

            words[i] = s1 << 32 | s0;
            uint64_t carry = s3 << 32 | s2;
            // add carry
            for (uint8_t j = i + 1; j < 4; j++) {
                words[j] += carry;
                if (carry > words[j]) {
                    carry = 1;
                } else break;
            }
        }
        uint8_t digit = *((*iter)++) - '0';
        // add digit
        for (uint8_t i = 0; i < 4; i++) {
            words[i] += digit;
            if (digit > words[i]) {
                digit = 1;
            } else break;
        }
    }
    if (negative) {
        // negate via -x = ~x + 1
        for (uint8_t i = 4; i --> 0;) {
            words[i] = ~words[i];
        }
        // add 1 with carry
        for (uint8_t i = 0; !++words[i++];);
    }
    uint64_t isNonzero = words[0] | words[1] | words[2] | words[3];
    if (!isNonzero) {
        return PUSH0;
    }
    uint8_t start = 0;
    // determine start
    for (uint8_t i = 4; i --> 0;) {
        for (uint8_t j = 8; j --> 0;) {
            uint64_t shift = j * 8;
            uint8_t byte = (words[i] & (0xffllu << shift)) >> shift;
            if (byte) {
                start = i * 8 + j;
                i = 0; // break outer
                break;
            }
        }
    }
    for (uint8_t i = 0; i < 4; i++) {
        for (uint8_t j = 0; j < 8; j++) {
            if (i * 8 + j > start) {
                break;
            }
            uint64_t shift = j * 8;
            uint8_t byte = (words[i] & (0xffllu << shift)) >> shift;
            scanstackPush(byte);
        }
    }
    return (op_t) PUSH1 + start;
}

// Assembly:
pxor %xmm0, %xmm0
movdqa %xmm0, -0x18(%rsp)
movdqa %xmm0, -0x28(%rsp)
movq (%rdi), %rcx
movb (%rcx), %al
leal -0x3a(%rax), %edx
cmpb $-0xa, %dl
setb %dl
cmpb $0x2d, %al
setne %al
testb %dl, %al
jne 0xf93b
movq %rcx, %rax
movl $0x4, %ecx
movl $0x3, %edx
movq -0x28(%rsp,%rdx,8), %r8
movl %r8d, %r9d
addq %r9, %r9
leaq (%r9,%r9,4), %r9
movl %r9d, %r10d
shrq $0x20, %r8
leaq (%r8,%r8,4), %r8
shrq $0x20, %r9
leaq (%r9,%r8,2), %r8
movq %r8, %r9
shlq $0x20, %r9
orq %r10, %r9
movq %r9, -0x28(%rsp,%rdx,8)
testb $-0x4, %cl
jne 0xf8f1
shrq $0x20, %r8
movq %rcx, %r9
addq %r8, -0x28(%rsp,%r9,8)
jae 0xf8f1
leaq 0x1(%r9), %r10
movl $0x1, %r8d
cmpq $0x3, %r9
movq %r10, %r9
jb 0xf8d7
decq %rcx
subq $0x1, %rdx
jae 0xf89a
leaq 0x1(%rax), %rcx
movq %rcx, (%rdi)
movb (%rax), %al
addb $-0x30, %al
movzbl %al, %edx
xorl %eax, %eax
addq %rdx, -0x28(%rsp,%rax,8)
jae 0xf923
leaq 0x1(%rax), %r8
movl $0x1, %edx
cmpq $0x3, %rax
movq %r8, %rax
jb 0xf90a
movb (%rcx), %al
leal -0x3a(%rax), %edx
cmpb $-0xa, %dl
setae %dl
cmpb $0x2d, %al
sete %al
orb %dl, %al
jne 0xf88d
testl %esi, %esi
je 0xf96d
pcmpeqd %xmm0, %xmm0
movdqa -0x18(%rsp), %xmm1
pxor %xmm0, %xmm1
movdqa %xmm1, -0x18(%rsp)
pxor -0x28(%rsp), %xmm0
movdqa %xmm0, -0x28(%rsp)
xorl %eax, %eax
movzbl %al, %ecx
incb %al
incq -0x28(%rsp,%rcx,8)
je 0xf961
movdqa -0x28(%rsp), %xmm0
por -0x18(%rsp), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
xorl $0xf, %eax
je 0xfa2f
movb $0x4, %al
movb $0x20, %dl
decb %al
movzbl %al, %ecx
movq -0x28(%rsp,%rcx,8), %rdi
movl $0x38, %r8d
movl %edx, %esi
cmpq $-0x8, %r8
je 0xf9c3
movl %r8d, %ecx
andb $-0x8, %cl
movq %rdi, %r9
shrq %cl, %r9
addq $-0x8, %r8
decb %sil
testb %r9b, %r9b
je 0xf9a3
jmp 0xf9cc
addb $-0x8, %dl
testb %al, %al
jne 0xf991
xorl %esi, %esi
movb 0x2049459(%rip), %r8b   # 0x2058e2c
movzbl %sil, %eax
xorl %edx, %edx
leaq 0x204ec70(%rip), %rsi   # 0x205e650
xorl %edi, %edi
movq %rdx, %r9
xorl %ecx, %ecx
movl %r8d, %r10d
cmpq %rax, %r9
ja 0xfa1c
movq -0x28(%rsp,%rdi,8), %r11
shrq %cl, %r11
leal 0x1(%r10), %r8d
movb %r8b, 0x204942a(%rip)   # 0x2058e2c
movzbl %r10b, %r10d
movb %r11b, (%r10,%rsi)
addq $0x8, %rcx
incq %r9
movl %r8d, %r10d
cmpq $0x40, %rcx
jne 0xf9ea
jmp 0xfa1f
movl %r10d, %r8d
incq %rdi
addq $0x8, %rdx
cmpq $0x4, %rdi
jne 0xf9e2
addb $0x60, %al
retq
movb $0x5f, %al
retq