// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/vsinkprintf.c
// Function: format_decode
static int format_decode(const char *fmt, struct format_spec *spec)
{
	static const char *length_mod = "hljzt";

	const char *start = fmt;

	spec->type = FT_NONE;
	spec->flags = 0;
	spec->width = 0;
	spec->qualifier = 0;
	spec->base = 10;

	while (*fmt && *fmt != '%')
		++fmt;

	if (fmt != start || !*fmt)
		return fmt - start;

	while (1) {
		int found = 1;
		++fmt;

		switch (*fmt) {
		case '+':
			spec->flags |= FF_SIGN;
			break;
		case '#':
			spec->flags |= FF_PREFIX;
			break;
		default:
			found = 0;
		}

		if (!found)
			break;
	};

	if (isdigit(*fmt))
		spec->width = strtol(fmt, (char **)&fmt, 10);

	if (strchr(length_mod, *fmt)) {
		spec->qualifier = *fmt++;

		if (*fmt == spec->qualifier) {
			spec->qualifier = toupper(spec->qualifier);
			++fmt;
		}
	}

	switch (*fmt) {
	case 'c':
		spec->type = FT_CHAR;
		return ++fmt - start;
	case 's':
		spec->type = FT_STR;
		return ++fmt - start;
	case '%':
		spec->type = FT_PERCENT;
		return ++fmt - start;
	case 'p':
		spec->type = FT_PTR;
		spec->base = 16;
		spec->flags = FF_PREFIX;
		return ++fmt - start;
	case 'd':
	case 'i':
		spec->flags |= FF_SIGNED;
	case 'o':
	case 'x':
	case 'X':
		if (*fmt == 'o')
			spec->base = 8;
		if (*fmt == 'X' || *fmt == 'x')
			spec->base = 16;
	case 'u':
		break;
	default:
		spec->type = FT_INVALID;
	}

	switch (spec->qualifier) {
	case 'H':
		spec->type = FT_BYTE;
		break;
	case 'h':
		spec->type = FT_SHORT;
		break;
	case 'l':
		spec->type = FT_LONG;
		break;
	case 'L':
		spec->type = FT_LLONG;
		break;
	case 'j':
		spec->type = FT_INTMAX;
		break;
	case 'z':
		spec->type = FT_SIZE;
		break;
	case 't':
		spec->type = FT_PTRDIFF;
		break;
	default:
		spec->type = FT_INT;
		break;
	}

	return ++fmt - start;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x18(%rbp), %rax
movl $0xa, 0x10(%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x25(%rbp)
je 0xffffffff80102891
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
setne %al
movb %al, -0x25(%rbp)
movb -0x25(%rbp), %al
testb $0x1, %al
jne 0xffffffff8010289a
jmp 0xffffffff801028a8
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xffffffff80102870
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0xffffffff801028bb
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xffffffff801028ce
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0xffffffff80102b9d
jmp 0xffffffff801028d0
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rax
incq %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x23, %eax
je 0xffffffff8010290f
jmp 0xffffffff801028f3
movl -0x2c(%rbp), %eax
subl $0x2b, %eax
jne 0xffffffff80102921
jmp 0xffffffff801028fd
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
orq $0x4, %rcx
movq %rcx, 0x8(%rax)
jmp 0xffffffff80102928
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
orq $0x8, %rcx
movq %rcx, 0x8(%rax)
jmp 0xffffffff80102928
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xffffffff80102930
jmp 0xffffffff80102932
jmp 0xffffffff801028d0
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0xffffffff801020e0
cmpl $0x0, %eax
je 0xffffffff8010295e
movq -0x10(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0xa, %edx
callq 0xffffffff80102150
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq 0x151cb(%rip), %rdi     # 0xffffffff80117b30
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
callq 0xffffffff80101910
cmpq $0x0, %rax
je 0xffffffff801029c3
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0xffffffff801029c1
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edi
callq 0xffffffff80102080
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xffffffff801029c3
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
addl $-0x25, %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x53, %eax
ja 0xffffffff80102aed
movq -0x38(%rbp), %rax
leaq 0xf3e9(%rip), %rcx      # 0xffffffff80111dd0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movq $0x1, (%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0xffffffff80102b9d
movq -0x18(%rbp), %rax
movq $0x2, (%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0xffffffff80102b9d
movq -0x18(%rbp), %rax
movq $0x3, (%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0xffffffff80102b9d
movq -0x18(%rbp), %rax
movq $0x4, (%rax)
movq -0x18(%rbp), %rax
movl $0x10, 0x10(%rax)
movq -0x18(%rbp), %rax
movq $0x8, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0xffffffff80102b9d
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
orq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6f, %eax
jne 0xffffffff80102ac6
movq -0x18(%rbp), %rax
movl $0x8, 0x10(%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x58, %eax
je 0xffffffff80102ade
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x78, %eax
jne 0xffffffff80102ae9
movq -0x18(%rbp), %rax
movl $0x10, 0x10(%rax)
jmp 0xffffffff80102aeb
jmp 0xffffffff80102af8
movq -0x18(%rbp), %rax
movq $0xd, (%rax)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
addl $-0x48, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x32, %eax
ja 0xffffffff80102b7c
movq -0x40(%rbp), %rax
leaq 0xf408(%rip), %rcx      # 0xffffffff80111f20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movq $0xc, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0xb, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0x9, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0x8, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0x5, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0x6, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0x7, (%rax)
jmp 0xffffffff80102b87
movq -0x18(%rbp), %rax
movq $0xa, (%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)