// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rosprite.c
// Function: do_sprite
static void do_sprite(deark *c, lctx *d, i64 index,
	i64 pos1, i64 len)
{
	de_finfo *fi = NULL;
	struct page_ctx *pg = NULL;
	i64 image_offset_raw, mask_offset_raw;
	i64 pos;
	int saved_indent_level;
	char descr[32];

	de_dbg_indent_save(c, &saved_indent_level);
	pg = de_malloc(c, sizeof(struct page_ctx));

	de_dbg(c, "image header at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);

	fi = de_finfo_create(c);

	pos = pos1+4;
	read_sprite_name(c, d, fi, pos);
	pos += 12;

	pg->width_in_words = de_getu32le_p(&pos) +1;
	pg->height = de_getu32le_p(&pos) +1;
	de_dbg(c, "width in words: %"I64_FMT, pg->width_in_words);
	de_dbg(c, "height: %"I64_FMT, pg->height);

	pg->first_bit = de_getu32le_p(&pos);
	if(pg->first_bit>31) pg->first_bit=31;
	pg->last_bit = de_getu32le_p(&pos);
	if(pg->last_bit>31) pg->last_bit=31;
	de_dbg(c, "first bit: %u", (UI)pg->first_bit);
	de_dbg(c, "last bit: %u", (UI)pg->last_bit);

	image_offset_raw = de_getu32le_p(&pos);
	pg->image_offset = pos1 + image_offset_raw;
	de_dbg(c, "image offset: %"I64_FMT" ("DE_CHAR_RIGHTARROW"%"I64_FMT")",
		image_offset_raw, pg->image_offset);

	mask_offset_raw = de_getu32le_p(&pos);
	pg->mask_offset = pos1 + mask_offset_raw;
	if(mask_offset_raw && (mask_offset_raw!=image_offset_raw)) {
		pg->has_mask = 1;
		pg->use_mask = 1; // Default
	}
	if(pg->has_mask) {
		de_snprintf(descr, sizeof(descr), DE_CHAR_RIGHTARROW"%"I64_FMT,
			pg->mask_offset);
	}
	else {
		de_strlcpy(descr, "no mask", sizeof(descr));
	}
	de_dbg(c, "mask offset: %"I64_FMT" (%s)", mask_offset_raw, descr);

	pg->mode = (u32)de_getu32le_p(&pos);
	de_dbg(c, "mode: 0x%08x", (unsigned int)pg->mode);

	de_dbg_indent(c, 1);

	pg->new_img_type = (pg->mode&0x78000000U)>>27;
	de_dbg(c, "format version: %s", (pg->new_img_type?"new":"old"));
	if(pg->new_img_type==0)
		de_dbg(c, "old format screen mode: %u", (UI)pg->mode);
	else
		de_dbg(c, "new format image type: %u", (UI)pg->new_img_type);

	if(pg->new_img_type!=0 && pg->first_bit!=0) {
		de_warn(c, "Invalid \"first bit\" value for new image format");
		pg->first_bit = 0;
	}

	if(pg->new_img_type==0) {
		// old format
		size_t x;

		for(x=0; x<DE_ARRAYCOUNT(old_mode_info_arr); x++) {
			if(pg->mode == (u32)old_mode_info_arr[x].mode) {
				pg->fgbpp = (i64)old_mode_info_arr[x].fgbpp;
				pg->xdpi = (i64)old_mode_info_arr[x].xdpi;
				pg->ydpi = (i64)old_mode_info_arr[x].ydpi;
				break;
			}
		}

		if(pg->fgbpp==0) {
			de_err(c, "Screen mode %u not supported", (UI)pg->mode);
			goto done;
		}

		if(pg->has_mask) {
			pg->mask_type = MASK_TYPE_OLD;
			pg->mask_rowspan = 4*pg->width_in_words;
			pg->maskbpp = pg->fgbpp;
			de_dbg(c, "mask type: old");
		}

		if(pg->fgbpp>8 && pg->has_mask) {
			de_warn(c, "Transparency not supported for this image type");
			pg->use_mask = 0;
		}

	}
	else {
		// new format
		pg->xdpi = (pg->mode&0x07ffc000)>>14;
		pg->ydpi = (pg->mode&0x00003ffe)>>1;
		de_dbg(c, "dpi: %d"DE_CHAR_TIMES"%d", (int)pg->xdpi, (int)pg->ydpi);
		switch(pg->new_img_type) {
		case 1: // ->1
		case 2: // ->2
		case 3: // ->4
		case 4: // ->8
		case 5: // ->16
		case 6: // ->32
			pg->fgbpp = 1LL<<(pg->new_img_type-1);
			break;
		//case 7: 32bpp CMYK (TODO)
		//case 8: 24bpp (TODO)
		default:
			de_err(c, "New format type %u not supported", (UI)pg->new_img_type);
			goto done;
		}

		if(pg->has_mask) {
			if(pg->mode&0x80000000U) {
				pg->mask_type = MASK_TYPE_NEW_8;
				pg->maskbpp = 8;
			}
			else {
				pg->mask_type = MASK_TYPE_NEW_1;
				pg->maskbpp = 1;
			}
			de_dbg(c, "mask type: new - %s", pg->mask_type==MASK_TYPE_NEW_8 ? "alpha" : "binary");
		}
	}

	de_dbg(c, "foreground bits/pixel: %d", (int)pg->fgbpp);

	de_dbg_indent(c, -1);

	pg->pdwidth = (pg->width_in_words * 32)/pg->fgbpp;
	pg->num_padding_pixels_at_start_of_row = pg->first_bit / pg->fgbpp;
	pg->num_padding_pixels_at_end_of_row = (32 - (pg->last_bit+1)) / pg->fgbpp;
	pg->npwidth = pg->pdwidth - pg->num_padding_pixels_at_start_of_row -
		pg->num_padding_pixels_at_end_of_row;
	if(c->padpix) {
		pg->width_1 = pg->pdwidth;
	}
	else {
		pg->width_1 = pg->pdwidth - pg->num_padding_pixels_at_end_of_row;
	}
	de_dbg(c, "width (calculated): %"I64_FMT, pg->npwidth);

	if(!de_good_image_dimensions(c, pg->npwidth, pg->height)) goto done;
	if(pg->width_1<1) goto done;

	if(pg->mask_type==MASK_TYPE_NEW_1 || pg->mask_type==MASK_TYPE_NEW_8) {
		pg->mask_rowspan = de_pad_to_n(pg->maskbpp*pg->npwidth, 32) / 8;
	}

	de_dbg_indent(c, -1);

	pg->custom_palette_pos = pos1 + 44;
	if(pg->image_offset >= pg->custom_palette_pos+8 && pg->fgbpp<=8) {
		pg->has_custom_palette = 1;
		pg->custom_palette_ncolors = (pg->image_offset - (pos1+44))/8;
		if(pg->custom_palette_ncolors>256) pg->custom_palette_ncolors=256;
	}

	do_setup_palette(c, d, pg);

	do_image(c, d, pg, fi);
done:
	de_dbg_indent_restore(c, saved_indent_level);
	de_finfo_destroy(c, fi);
	if(pg) {
		if(pg->img) de_bitmap_destroy(pg->img);
		if(pg->mask) de_bitmap_destroy(pg->mask);
		de_free(c, pg);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movl $0x8c0, %esi            # imm = 0x8C0
callq 0x15b780
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xa5301(%rip), %rsi     # 0x1c5fbe
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq 0x121530
movq -0x50(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
addq $0x1, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
addq $0x1, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x9b377(%rip), %rsi     # 0x1bc0d6
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0x8ff24(%rip), %rsi     # 0x1b0c9d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
cmpq $0x1f, 0x18(%rax)
jle 0x120db3
movq -0x38(%rbp), %rax
movq $0x1f, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
cmpq $0x1f, 0x20(%rax)
jle 0x120de6
movq -0x38(%rbp), %rax
movq $0x1f, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %edx
leaq 0xa51d7(%rip), %rsi     # 0x1c5fd2
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, %edx
leaq 0xa51c9(%rip), %rsi     # 0x1c5fe0
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rcx
addq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rcx
leaq 0xa518d(%rip), %rsi     # 0x1c5fed
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rcx
addq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x90(%rax)
cmpq $0x0, -0x48(%rbp)
je 0x120eb0
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x120eb0
movq -0x38(%rbp), %rax
movb $0x1, 0x78(%rax)
movq -0x38(%rbp), %rax
movb $0x1, 0x79(%rax)
movq -0x38(%rbp), %rax
cmpb $0x0, 0x78(%rax)
je 0x120ede
leaq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x90(%rax), %rcx
movl $0x20, %esi
leaq 0xa5133(%rip), %rdx     # 0x1c6008
movb $0x0, %al
callq 0x15a980
jmp 0x120ef3
leaq -0x80(%rbp), %rdi
leaq 0xa5126(%rip), %rsi     # 0x1c600f
movl $0x20, %edx
callq 0x15aa30
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x80(%rbp), %rcx
leaq 0xa5111(%rip), %rsi     # 0x1c6017
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x165580
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x70(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x70(%rax), %edx
leaq 0xb059c(%rip), %rsi     # 0x1d14d5
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x38(%rbp), %rax
movl 0x70(%rax), %ecx
andl $0x78000000, %ecx       # imm = 0x78000000
shrl $0x1b, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x74(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x74(%rax), %ecx
leaq 0xa5155(%rip), %rdx     # 0x1c60cc
leaq 0x88f8f(%rip), %rax     # 0x1a9f0d
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0xa50a1(%rip), %rsi     # 0x1c602d
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x74(%rax)
jne 0x120fb8
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x70(%rax), %edx
leaq 0xa5091(%rip), %rsi     # 0x1c6040
movb $0x0, %al
callq 0x15b0d0
jmp 0x120fd1
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x74(%rax), %edx
leaq 0xa5091(%rip), %rsi     # 0x1c605b
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x74(%rax)
je 0x121004
movq -0x38(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x121004
movq -0x8(%rbp), %rdi
leaq 0xa5084(%rip), %rsi     # 0x1c6075
movb $0x0, %al
callq 0x15bc10
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x74(%rax)
jne 0x121164
movq $0x0, -0x88(%rbp)
cmpq $0x30, -0x88(%rbp)
jae 0x1210b9
movq -0x38(%rbp), %rax
movl 0x70(%rax), %eax
movq -0x88(%rbp), %rdx
leaq 0xa51d0(%rip), %rcx     # 0x1c6210
movzbl (%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jne 0x1210a0
movq -0x88(%rbp), %rcx
leaq 0xa51ba(%rip), %rax     # 0x1c6210
movzbl 0x1(%rax,%rcx,4), %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x88(%rbp), %rcx
leaq 0xa519e(%rip), %rax     # 0x1c6210
movzbl 0x2(%rax,%rcx,4), %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x88(%rbp), %rcx
leaq 0xa5181(%rip), %rax     # 0x1c6210
movzbl 0x3(%rax,%rcx,4), %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, 0x68(%rax)
jmp 0x1210b9
jmp 0x1210a2
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x12101d
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1210e1
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x70(%rax), %edx
leaq 0xa4fcf(%rip), %rsi     # 0x1c60a4
movb $0x0, %al
callq 0x15bfb0
jmp 0x1214b8
movq -0x38(%rbp), %rax
cmpb $0x0, 0x78(%rax)
je 0x12112e
movq -0x38(%rbp), %rax
movl $0x1, 0x7c(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shlq $0x2, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
leaq 0xa4f9a(%rip), %rsi     # 0x1c60c1
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
cmpq $0x8, (%rax)
jle 0x12115f
movq -0x38(%rbp), %rax
movzbl 0x78(%rax), %eax
cmpl $0x0, %eax
je 0x12115f
movq -0x8(%rbp), %rdi
leaq 0xa4f80(%rip), %rsi     # 0x1c60d0
movb $0x0, %al
callq 0x15bc10
movq -0x38(%rbp), %rax
movb $0x0, 0x79(%rax)
jmp 0x121272
movq -0x38(%rbp), %rax
movl 0x70(%rax), %ecx
andl $0x7ffc000, %ecx        # imm = 0x7FFC000
shrl $0xe, %ecx
movq %rcx, 0x60(%rax)
movq -0x38(%rbp), %rax
movl 0x70(%rax), %ecx
andl $0x3ffe, %ecx           # imm = 0x3FFE
shrl %ecx
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x60(%rax), %edx
movl 0x68(%rax), %ecx
leaq 0x93a98(%rip), %rsi     # 0x1b4c38
xorl %eax, %eax
callq 0x15b0d0
movq -0x38(%rbp), %rax
movl 0x74(%rax), %eax
decl %eax
subl $0x5, %eax
ja 0x1211d9
jmp 0x1211b7
movq -0x38(%rbp), %rax
movl 0x74(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1211f7
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x74(%rax), %edx
leaq 0xa4f14(%rip), %rsi     # 0x1c60ff
movb $0x0, %al
callq 0x15bfb0
jmp 0x1214b8
movq -0x38(%rbp), %rax
cmpb $0x0, 0x78(%rax)
je 0x121270
movq -0x38(%rbp), %rax
movl 0x70(%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x12122b
movq -0x38(%rbp), %rax
movl $0x3, 0x7c(%rax)
movq -0x38(%rbp), %rax
movq $0x8, 0x8(%rax)
jmp 0x121242
movq -0x38(%rbp), %rax
movl $0x2, 0x7c(%rax)
movq -0x38(%rbp), %rax
movq $0x1, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x7c(%rax), %ecx
leaq 0xaada4(%rip), %rdx     # 0x1cbff8
leaq 0xa1f23(%rip), %rax     # 0x1c317e
cmpl $0x3, %ecx
cmoveq %rax, %rdx
leaq 0xa4eb7(%rip), %rsi     # 0x1c6120
movb $0x0, %al
callq 0x15b0d0
jmp 0x121272
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl %eax, %edx
leaq 0xa4eae(%rip), %rsi     # 0x1c6134
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
shlq $0x5, %rax
movq -0x38(%rbp), %rcx
cqto
idivq (%rcx)
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
cqto
idivq (%rcx)
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movl $0x20, %eax
subq %rcx, %rax
movq -0x38(%rbp), %rcx
cqto
idivq (%rcx)
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x38(%rbp), %rax
subq 0x50(%rax), %rcx
movq -0x38(%rbp), %rax
subq 0x58(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, 0xd5(%rax)
je 0x12133e
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x121356
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x38(%rbp), %rax
subq 0x58(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0xa4de5(%rip), %rsi     # 0x1c614e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0x121393
jmp 0x1214b8
movq -0x38(%rbp), %rax
cmpq $0x1, 0x38(%rax)
jge 0x1213a3
jmp 0x1214b8
movq -0x38(%rbp), %rax
cmpl $0x2, 0x7c(%rax)
je 0x1213b7
movq -0x38(%rbp), %rax
cmpl $0x3, 0x7c(%rax)
jne 0x1213ea
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rax
imulq 0x28(%rax), %rdi
movl $0x20, %esi
callq 0x15ce90
movl $0x8, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x20(%rbp), %rcx
addq $0x2c, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0xb0(%rcx), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
jl 0x121492
movq -0x38(%rbp), %rax
cmpq $0x8, (%rax)
jg 0x121492
movq -0x38(%rbp), %rax
movl $0x1, 0xa8(%rax)
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x20(%rbp), %rcx
addq $0x2c, %rcx
subq %rcx, %rax
movl $0x8, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0xb8(%rax)
movq -0x38(%rbp), %rax
cmpq $0x100, 0xb8(%rax) # imm = 0x100
jle 0x121490
movq -0x38(%rbp), %rax
movq $0x100, 0xb8(%rax) # imm = 0x100
jmp 0x121492
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x121600
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x1218f0
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x15b5a0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x15d260
cmpq $0x0, -0x38(%rbp)
je 0x121521
movq -0x38(%rbp), %rax
cmpq $0x0, 0x98(%rax)
je 0x1214f6
movq -0x38(%rbp), %rax
movq 0x98(%rax), %rdi
callq 0x16af60
movq -0x38(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x121514
movq -0x38(%rbp), %rax
movq 0xa0(%rax), %rdi
callq 0x16af60
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x15b820
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)