// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/util.c
// Function: memtoll
long long memtoll(const char *p, int *err) {
    const char *u;
    char buf[128];
    long mul; /* unit multiplier */
    long long val;
    unsigned int digits;

    if (err) *err = 0;
    /* Search the first non digit character. */
    u = p;
    if (*u == '-') u++;
    while(*u && isdigit(*u)) u++;
    if (*u == '\0' || !strcasecmp(u,"b")) {
        mul = 1;
    } else if (!strcasecmp(u,"k")) {
        mul = 1000;
    } else if (!strcasecmp(u,"kb")) {
        mul = 1024;
    } else if (!strcasecmp(u,"m")) {
        mul = 1000*1000;
    } else if (!strcasecmp(u,"mb")) {
        mul = 1024*1024;
    } else if (!strcasecmp(u,"g")) {
        mul = 1000L*1000*1000;
    } else if (!strcasecmp(u,"gb")) {
        mul = 1024L*1024*1024;
    } else {
        if (err) *err = 1;
        mul = 1;
    }
    digits = u-p;
    if (digits >= sizeof(buf)) {
        if (err) *err = 1;
        return LLONG_MAX;
    }
    memcpy(buf,p,digits);
    buf[digits] = '\0';
    val = strtoll(buf,NULL,10);
    return val*mul;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x280c4
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x280e4
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x280e6
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xb5(%rbp)
je 0x28121
callq 0x129b0
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
setne %al
movb %al, -0xb5(%rbp)
movb -0xb5(%rbp), %al
testb $0x1, %al
jne 0x2812d
jmp 0x2813b
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x280e6
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2815c
movq -0x20(%rbp), %rdi
leaq 0x7d4b8(%rip), %rsi     # 0xa560a
callq 0x12070
cmpl $0x0, %eax
jne 0x2816c
movq $0x1, -0xa8(%rbp)
jmp 0x28269
movq -0x20(%rbp), %rdi
leaq 0x82d8a(%rip), %rsi     # 0xaaf01
callq 0x12070
cmpl $0x0, %eax
jne 0x28191
movq $0x3e8, -0xa8(%rbp) # imm = 0x3E8
jmp 0x28267
movq -0x20(%rbp), %rdi
leaq 0x7e62b(%rip), %rsi     # 0xa67c7
callq 0x12070
cmpl $0x0, %eax
jne 0x281b6
movq $0x400, -0xa8(%rbp) # imm = 0x400
jmp 0x28265
movq -0x20(%rbp), %rdi
leaq 0x81049(%rip), %rsi     # 0xa920a
callq 0x12070
cmpl $0x0, %eax
jne 0x281db
movq $0xf4240, -0xa8(%rbp) # imm = 0xF4240
jmp 0x28263
movq -0x20(%rbp), %rdi
leaq 0x7e5da(%rip), %rsi     # 0xa67c0
callq 0x12070
cmpl $0x0, %eax
jne 0x281fd
movq $0x100000, -0xa8(%rbp) # imm = 0x100000
jmp 0x28261
movq -0x20(%rbp), %rdi
leaq 0x7d538(%rip), %rsi     # 0xa5740
callq 0x12070
cmpl $0x0, %eax
jne 0x2821f
movq $0x3b9aca00, -0xa8(%rbp) # imm = 0x3B9ACA00
jmp 0x2825f
movq -0x20(%rbp), %rdi
leaq 0x7e58f(%rip), %rsi     # 0xa67b9
callq 0x12070
cmpl $0x0, %eax
jne 0x28241
movq $0x40000000, -0xa8(%rbp) # imm = 0x40000000
jmp 0x2825d
cmpq $0x0, -0x18(%rbp)
je 0x28252
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movq $0x1, -0xa8(%rbp)
jmp 0x2825f
jmp 0x28261
jmp 0x28263
jmp 0x28265
jmp 0x28267
jmp 0x28269
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpq $0x80, %rax
jb 0x282a9
cmpq $0x0, -0x18(%rbp)
je 0x28299
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x8(%rbp)
jmp 0x282fe
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0xb4(%rbp), %eax
movl %eax, %edx
callq 0x12500
movl -0xb4(%rbp), %eax
movb $0x0, -0xa0(%rbp,%rax)
leaq -0xa0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x124a0
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
imulq -0xa8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)