// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/cram_io.c
// Function: cram_write_SAM_hdr
int cram_write_SAM_hdr(cram_fd *fd, SAM_hdr *hdr) {
    int header_len;
    int blank_block = (CRAM_MAJOR_VERS(fd->version) >= 3);

    /* Write CRAM MAGIC if not yet written. */
    if (fd->file_def->major_version == 0) {
	fd->file_def->major_version = CRAM_MAJOR_VERS(fd->version);
	fd->file_def->minor_version = CRAM_MINOR_VERS(fd->version);
	if (0 != cram_write_file_def(fd, fd->file_def))
	    return -1;
    }

    /* 1.0 requires an UNKNOWN read-group */
    if (CRAM_MAJOR_VERS(fd->version) == 1) {
	if (!sam_hdr_find_rg(hdr, "UNKNOWN"))
	    if (sam_hdr_add(hdr, "RG",
			    "ID", "UNKNOWN", "SM", "UNKNOWN", NULL))
		return -1;
    }

    /* Fix M5 strings */
    if (fd->refs && !fd->no_ref) {
	int i;
	for (i = 0; i < hdr->nref; i++) {
	    SAM_hdr_type *ty;
	    char *ref;

	    if (!(ty = sam_hdr_find(hdr, "SQ", "SN", hdr->ref[i].name)))
		return -1;

	    if (!sam_hdr_find_key(hdr, ty, "M5", NULL)) {
		char unsigned buf[16];
		char buf2[33];
		int rlen;
		hts_md5_context *md5;

		if (!fd->refs ||
		    !fd->refs->ref_id ||
		    !fd->refs->ref_id[i]) {
		    return -1;
		}
		rlen = fd->refs->ref_id[i]->length;
		if (!(md5 = hts_md5_init()))
		    return -1;
		ref = cram_get_ref(fd, i, 1, rlen);
		if (NULL == ref) return -1;
		rlen = fd->refs->ref_id[i]->length; /* In case it just loaded */
		hts_md5_update(md5, ref, rlen);
		hts_md5_final(buf, md5);
		hts_md5_destroy(md5);
		cram_ref_decr(fd->refs, i);

		hts_md5_hex(buf2, buf);
		if (sam_hdr_update(hdr, ty, "M5", buf2, NULL))
		    return -1;
	    }

	    if (fd->ref_fn) {
		char ref_fn[PATH_MAX];
		full_path(ref_fn, fd->ref_fn);
		if (sam_hdr_update(hdr, ty, "UR", ref_fn, NULL))
		    return -1;
	    }
	}
    }

    if (sam_hdr_rebuild(hdr))
	return -1;

    /* Length */
    header_len = sam_hdr_length(hdr);
    if (CRAM_MAJOR_VERS(fd->version) == 1) {
	if (-1 == int32_encode(fd, header_len))
	    return -1;

	/* Text data */
	if (header_len != hwrite(fd->fp, sam_hdr_str(hdr), header_len))
	    return -1;
    } else {
	/* Create block(s) inside a container */
	cram_block *b = cram_new_block(FILE_HEADER, 0);
	cram_container *c = cram_new_container(0, 0);
	int padded_length;
	char *pads;
	int is_cram_3 = (CRAM_MAJOR_VERS(fd->version) >= 3);

	if (!b || !c) {
	    if (b) cram_free_block(b);
	    if (c) cram_free_container(c);
	    return -1;
	}

	int32_put_blk(b, header_len);
	BLOCK_APPEND(b, sam_hdr_str(hdr), header_len);
	BLOCK_UPLEN(b);

	// Compress header block if V3.0 and above
	if (CRAM_MAJOR_VERS(fd->version) >= 3)
	    cram_compress_block(fd, b, NULL, -1, -1);

	if (blank_block) {
	    c->length = b->comp_size + 2 + 4*is_cram_3 +
		itf8_size(b->content_id)   + 
		itf8_size(b->uncomp_size)  +
		itf8_size(b->comp_size);

	    c->num_blocks = 2;
	    c->num_landmarks = 2;
	    if (!(c->landmark = malloc(2*sizeof(*c->landmark)))) {
		cram_free_block(b);
		cram_free_container(c);
		return -1;
	    }
	    c->landmark[0] = 0;
	    c->landmark[1] = c->length;

	    // Plus extra storage for uncompressed secondary blank block
	    padded_length = MIN(c->length*.5, 10000);
	    c->length += padded_length + 2 + 4*is_cram_3 +
		itf8_size(b->content_id) + 
		itf8_size(padded_length)*2;
	} else {
	    // Pad the block instead.
	    c->num_blocks = 1;
	    c->num_landmarks = 1;
	    if (!(c->landmark = malloc(sizeof(*c->landmark))))
		return -1;
	    c->landmark[0] = 0;

	    padded_length = MAX(c->length*1.5, 10000) - c->length;

	    c->length = b->comp_size + padded_length +
		2 + 4*is_cram_3 +
		itf8_size(b->content_id)   + 
		itf8_size(b->uncomp_size)  +
		itf8_size(b->comp_size);

	    if (NULL == (pads = calloc(1, padded_length))) {
		cram_free_block(b);
		cram_free_container(c);
		return -1;
	    }
	    BLOCK_APPEND(b, pads, padded_length);
	    BLOCK_UPLEN(b);
	    free(pads);
	}

	if (-1 == cram_write_container(fd, c)) {
	    cram_free_block(b);
	    cram_free_container(c);
	    return -1;
	}

	if (-1 == cram_write_block(fd, b)) {
	    cram_free_block(b);
	    cram_free_container(c);
	    return -1;
	}

	if (blank_block) {
	    BLOCK_RESIZE(b, padded_length);
	    memset(BLOCK_DATA(b), 0, padded_length);
	    BLOCK_SIZE(b) = padded_length;
	    BLOCK_UPLEN(b);
	    b->method = RAW;
	    if (-1 == cram_write_block(fd, b)) {
		cram_free_block(b);
		cram_free_container(c);
		return -1;
	    }
	}

	cram_free_block(b);
	cram_free_container(c);
    }

    if (-1 == refs_from_header(fd->refs, fd, fd->header))
	return -1;
    if (-1 == refs2id(fd->refs, fd->header))
	return -1;

    if (0 != hflush(fd->fp))
	return -1;

    RP("=== Finishing saving header ===\n");

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1180, %rsp           # imm = 0x1180
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
jne 0x88c03
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb %cl, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x88390
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x88c01
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x88c03
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x88c71
movq -0x18(%rbp), %rdi
leaq 0x5a38c(%rip), %rsi     # 0xe2fa9
callq 0x96cf0
cmpq $0x0, %rax
jne 0x88c6f
movq -0x18(%rbp), %rdi
leaq 0x5a37e(%rip), %rsi     # 0xe2fb1
leaq 0x5a37a(%rip), %rdx     # 0xe2fb4
leaq 0x5a368(%rip), %r9      # 0xe2fa9
leaq 0x5a36f(%rip), %r8      # 0xe2fb7
xorl %eax, %eax
movq %r9, %rcx
movq $0x0, (%rsp)
movb $0x0, %al
callq 0x94770
cmpl $0x0, %eax
je 0x88c6d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x88c6f
jmp 0x88c71
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x88ebb
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20c(%rax)
jne 0x88ebb
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x88eb9
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
leaq 0x5b751(%rip), %rsi     # 0xe441a
leaq 0x5a2ea(%rip), %rdx     # 0xe2fba
callq 0x95220
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x88ceb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x5a2c3(%rip), %rdx     # 0xe2fbd
xorl %eax, %eax
movl %eax, %ecx
callq 0x95990
cmpq $0x0, %rax
jne 0x88e55
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x88d3e
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x88d3e
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x88d4a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movl %eax, -0x84(%rbp)
callq 0xa5280
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
jne 0x88d86
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x84(%rbp), %ecx
movl $0x1, %edx
callq 0x81ee0
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq -0x38(%rbp), %rax
jne 0x88db5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movl %eax, -0x84(%rbp)
movq -0x90(%rbp), %rdi
movq -0x38(%rbp), %rsi
movslq -0x84(%rbp), %rdx
callq 0xa3e90
leaq -0x50(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0xa4ff0
movq -0x90(%rbp), %rdi
callq 0xa52d0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x24(%rbp), %esi
callq 0x81740
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xa5300
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x80(%rbp), %rcx
leaq 0x5a187(%rip), %rdx     # 0xe2fbd
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x95a40
cmpl $0x0, %eax
je 0x88e53
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x88e55
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x88ea9
leaq -0x1090(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rsi
callq 0x89e00
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x1090(%rbp), %rcx
leaq 0x512cc(%rip), %rdx     # 0xda156
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x95a40
cmpl $0x0, %eax
je 0x88ea7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x88ea9
jmp 0x88eab
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x88c98
jmp 0x88ebb
movq -0x18(%rbp), %rdi
callq 0x95cf0
cmpl $0x0, %eax
je 0x88ed5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x18(%rbp), %rdi
callq 0x96be0
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x88f68
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x7dc70
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x88f13
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movslq -0x1c(%rbp), %rax
movq %rax, -0x10c0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10c8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x96bc0
movq -0x10c8(%rbp), %rdi
movq %rax, %rsi
movslq -0x1c(%rbp), %rdx
callq 0x7bcb0
movq %rax, %rcx
movq -0x10c0(%rbp), %rax
cmpq %rcx, %rax
je 0x88f63
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x89d71
xorl %esi, %esi
movl %esi, %edi
callq 0x7e1a0
movq %rax, -0x1098(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0x838a0
movq %rax, -0x10a0(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x10b4(%rbp)
cmpq $0x0, -0x1098(%rbp)
je 0x88fb7
cmpq $0x0, -0x10a0(%rbp)
jne 0x88fef
cmpq $0x0, -0x1098(%rbp)
je 0x88fcd
movq -0x1098(%rbp), %rdi
callq 0x7f750
cmpq $0x0, -0x10a0(%rbp)
je 0x88fe3
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x1098(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x7dd70
jmp 0x89000
jmp 0x89002
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x1098(%rbp), %rcx
movq 0x30(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x890f3
movq -0x1098(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x8907a
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %xmm0
movaps 0x4cfd7(%rip), %xmm1    # 0xd6020
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x4cfdb(%rip), %xmm1    # 0xd6030
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x51604(%rip), %xmm1    # 0xda670
mulsd %xmm1, %xmm0
movsd %xmm0, -0x10d0(%rbp)
jmp 0x8908c
movsd 0x59b36(%rip), %xmm0    # 0xe2bb8
movsd %xmm0, -0x10d0(%rbp)
jmp 0x8908c
movsd -0x10d0(%rbp), %xmm0
movsd 0x58fbc(%rip), %xmm2    # 0xe2058
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x6c80
movq %rax, %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x89002
jmp 0x890f5
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x1098(%rbp), %rcx
addq 0x30(%rcx), %rax
movq %rax, -0x10d8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x96bc0
movq -0x10d8(%rbp), %rdi
movq %rax, %rsi
movslq -0x1c(%rbp), %rdx
callq 0x6570
movslq -0x1c(%rbp), %rcx
movq -0x1098(%rbp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq -0x1098(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x1098(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x1098(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
jl 0x8918e
movq -0x10(%rbp), %rdi
movq -0x1098(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl %r8d, %ecx
callq 0x7f960
cmpl $0x0, -0x20(%rbp)
je 0x8966f
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
addl $0x2, %eax
movl -0x10b4(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x10dc(%rbp)
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x891d8
movl $0x1, %eax
movl %eax, -0x10e0(%rbp)
jmp 0x89260
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x891f9
movl $0x2, %eax
movl %eax, -0x10e4(%rbp)
jmp 0x89254
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x8921a
movl $0x3, %eax
movl %eax, -0x10e8(%rbp)
jmp 0x89248
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x10e8(%rbp)
movl -0x10e8(%rbp), %eax
movl %eax, -0x10e4(%rbp)
movl -0x10e4(%rbp), %eax
movl %eax, -0x10e0(%rbp)
movl -0x10dc(%rbp), %eax
movl -0x10e0(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x10ec(%rbp)
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x89296
movl $0x1, %eax
movl %eax, -0x10f0(%rbp)
jmp 0x8931e
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x892b7
movl $0x2, %eax
movl %eax, -0x10f4(%rbp)
jmp 0x89312
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x892d8
movl $0x3, %eax
movl %eax, -0x10f8(%rbp)
jmp 0x89306
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x10f8(%rbp)
movl -0x10f8(%rbp), %eax
movl %eax, -0x10f4(%rbp)
movl -0x10f4(%rbp), %eax
movl %eax, -0x10f0(%rbp)
movl -0x10ec(%rbp), %eax
movl -0x10f0(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x10fc(%rbp)
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x89354
movl $0x1, %eax
movl %eax, -0x1100(%rbp)
jmp 0x893dc
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x89375
movl $0x2, %eax
movl %eax, -0x1104(%rbp)
jmp 0x893d0
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x89396
movl $0x3, %eax
movl %eax, -0x1108(%rbp)
jmp 0x893c4
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x1108(%rbp)
movl -0x1108(%rbp), %eax
movl %eax, -0x1104(%rbp)
movl -0x1104(%rbp), %eax
movl %eax, -0x1100(%rbp)
movl -0x10fc(%rbp), %ecx
movl -0x1100(%rbp), %eax
addl %eax, %ecx
movq -0x10a0(%rbp), %rax
movl %ecx, (%rax)
movq -0x10a0(%rbp), %rax
movl $0x2, 0x24(%rax)
movq -0x10a0(%rbp), %rax
movl $0x2, 0x28(%rax)
movl $0x8, %edi
callq 0x69c0
movq -0x10a0(%rbp), %rcx
movq %rax, 0x30(%rcx)
cmpq $0x0, %rax
jne 0x8944e
movq -0x1098(%rbp), %rdi
callq 0x7f750
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10a0(%rbp), %rax
movq 0x30(%rax), %rax
movl $0x0, (%rax)
movq -0x10a0(%rbp), %rax
movl (%rax), %ecx
movq -0x10a0(%rbp), %rax
movq 0x30(%rax), %rax
movl %ecx, 0x4(%rax)
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
movsd 0x4f7af(%rip), %xmm0    # 0xd8c38
mulsd %xmm0, %xmm1
movsd 0x5976b(%rip), %xmm0    # 0xe2c00
ucomisd %xmm1, %xmm0
jbe 0x894bc
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x4f78a(%rip), %xmm1    # 0xd8c38
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1110(%rbp)
jmp 0x894ce
movsd 0x5973c(%rip), %xmm0    # 0xe2c00
movsd %xmm0, -0x1110(%rbp)
jmp 0x894ce
movsd -0x1110(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10a4(%rbp)
movl -0x10a4(%rbp), %eax
addl $0x2, %eax
movl -0x10b4(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x1114(%rbp)
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x8951c
movl $0x1, %eax
movl %eax, -0x1118(%rbp)
jmp 0x895a4
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x8953d
movl $0x2, %eax
movl %eax, -0x111c(%rbp)
jmp 0x89598
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x8955e
movl $0x3, %eax
movl %eax, -0x1120(%rbp)
jmp 0x8958c
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x1120(%rbp)
movl -0x1120(%rbp), %eax
movl %eax, -0x111c(%rbp)
movl -0x111c(%rbp), %eax
movl %eax, -0x1118(%rbp)
movl -0x1114(%rbp), %eax
movl -0x1118(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x1124(%rbp)
movl -0x10a4(%rbp), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x895d3
movl $0x1, %eax
movl %eax, -0x1128(%rbp)
jmp 0x8964f
movl -0x10a4(%rbp), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x895f0
movl $0x2, %eax
movl %eax, -0x112c(%rbp)
jmp 0x89643
movl -0x10a4(%rbp), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x8960d
movl $0x3, %eax
movl %eax, -0x1130(%rbp)
jmp 0x89637
movl -0x10a4(%rbp), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x1130(%rbp)
movl -0x1130(%rbp), %eax
movl %eax, -0x112c(%rbp)
movl -0x112c(%rbp), %eax
movl %eax, -0x1128(%rbp)
movl -0x1124(%rbp), %ecx
movl -0x1128(%rbp), %eax
shll %eax
addl %eax, %ecx
movq -0x10a0(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x89b4b
movq -0x10a0(%rbp), %rax
movl $0x1, 0x24(%rax)
movq -0x10a0(%rbp), %rax
movl $0x1, 0x28(%rax)
movl $0x4, %edi
callq 0x69c0
movq -0x10a0(%rbp), %rcx
movq %rax, 0x30(%rcx)
cmpq $0x0, %rax
jne 0x896b2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10a0(%rbp), %rax
movq 0x30(%rax), %rax
movl $0x0, (%rax)
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x50f9a(%rip), %xmm1    # 0xda670
mulsd %xmm1, %xmm0
movsd 0x5951e(%rip), %xmm1    # 0xe2c00
ucomisd %xmm1, %xmm0
jbe 0x89709
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x50f75(%rip), %xmm1    # 0xda670
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1138(%rbp)
jmp 0x8971b
movsd 0x594ef(%rip), %xmm0    # 0xe2c00
movsd %xmm0, -0x1138(%rbp)
jmp 0x8971b
movsd -0x1138(%rbp), %xmm0
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10a4(%rbp)
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
addl -0x10a4(%rbp), %eax
addl $0x2, %eax
movl -0x10b4(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x113c(%rbp)
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x89782
movl $0x1, %eax
movl %eax, -0x1140(%rbp)
jmp 0x8980a
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x897a3
movl $0x2, %eax
movl %eax, -0x1144(%rbp)
jmp 0x897fe
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x897c4
movl $0x3, %eax
movl %eax, -0x1148(%rbp)
jmp 0x897f2
movq -0x1098(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x1148(%rbp)
movl -0x1148(%rbp), %eax
movl %eax, -0x1144(%rbp)
movl -0x1144(%rbp), %eax
movl %eax, -0x1140(%rbp)
movl -0x113c(%rbp), %eax
movl -0x1140(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x114c(%rbp)
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x89840
movl $0x1, %eax
movl %eax, -0x1150(%rbp)
jmp 0x898c8
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x89861
movl $0x2, %eax
movl %eax, -0x1154(%rbp)
jmp 0x898bc
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x89882
movl $0x3, %eax
movl %eax, -0x1158(%rbp)
jmp 0x898b0
movq -0x1098(%rbp), %rax
movl 0x14(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x1158(%rbp)
movl -0x1158(%rbp), %eax
movl %eax, -0x1154(%rbp)
movl -0x1154(%rbp), %eax
movl %eax, -0x1150(%rbp)
movl -0x114c(%rbp), %eax
movl -0x1150(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x115c(%rbp)
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x898fe
movl $0x1, %eax
movl %eax, -0x1160(%rbp)
jmp 0x89986
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xffffc000, %eax       # imm = 0xFFFFC000
cmpl $0x0, %eax
jne 0x8991f
movl $0x2, %eax
movl %eax, -0x1164(%rbp)
jmp 0x8997a
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x0, %eax
jne 0x89940
movl $0x3, %eax
movl %eax, -0x1168(%rbp)
jmp 0x8996e
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x1168(%rbp)
movl -0x1168(%rbp), %eax
movl %eax, -0x1164(%rbp)
movl -0x1164(%rbp), %eax
movl %eax, -0x1160(%rbp)
movl -0x115c(%rbp), %ecx
movl -0x1160(%rbp), %eax
addl %eax, %ecx
movq -0x10a0(%rbp), %rax
movl %ecx, (%rax)
movslq -0x10a4(%rbp), %rsi
movl $0x1, %edi
callq 0x6460
movq %rax, %rcx
movq %rcx, -0x10b0(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x899e3
movq -0x1098(%rbp), %rdi
callq 0x7f750
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x899e5
jmp 0x899e7
jmp 0x899e9
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x1098(%rbp), %rcx
movq 0x30(%rcx), %rcx
movslq -0x10a4(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x89add
movq -0x1098(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x89a64
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %xmm0
movaps 0x4c5ed(%rip), %xmm1    # 0xd6020
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x4c5f1(%rip), %xmm1    # 0xd6030
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x50c1a(%rip), %xmm1    # 0xda670
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1170(%rbp)
jmp 0x89a76
movsd 0x5914c(%rip), %xmm0    # 0xe2bb8
movsd %xmm0, -0x1170(%rbp)
jmp 0x89a76
movsd -0x1170(%rbp), %xmm0
movsd 0x585d2(%rip), %xmm2    # 0xe2058
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x6c80
movq %rax, %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x899e9
jmp 0x89adf
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x1098(%rbp), %rax
addq 0x30(%rax), %rdi
movq -0x10b0(%rbp), %rsi
movslq -0x10a4(%rbp), %rdx
callq 0x6570
movslq -0x10a4(%rbp), %rcx
movq -0x1098(%rbp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq -0x1098(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x1098(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x1098(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10b0(%rbp), %rdi
callq 0x6880
movq -0x10(%rbp), %rdi
movq -0x10a0(%rbp), %rsi
callq 0x85e60
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x89b8a
movq -0x1098(%rbp), %rdi
callq 0x7f750
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10(%rbp), %rdi
movq -0x1098(%rbp), %rsi
callq 0x7ed00
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x89bc9
movq -0x1098(%rbp), %rdi
callq 0x7f750
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
cmpl $0x0, -0x20(%rbp)
je 0x89d59
jmp 0x89bd5
jmp 0x89bd7
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x10a4(%rbp), %rcx
cmpq %rcx, %rax
ja 0x89cbd
movq -0x1098(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x89c44
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %xmm0
movaps 0x4c40d(%rip), %xmm1    # 0xd6020
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x4c411(%rip), %xmm1    # 0xd6030
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x50a3a(%rip), %xmm1    # 0xda670
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1178(%rbp)
jmp 0x89c56
movsd 0x58f6c(%rip), %xmm0    # 0xe2bb8
movsd %xmm0, -0x1178(%rbp)
jmp 0x89c56
movsd -0x1178(%rbp), %xmm0
movsd 0x583f2(%rip), %xmm2    # 0xe2058
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x1098(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x6c80
movq %rax, %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x89bd7
jmp 0x89cbf
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x10a4(%rbp), %rdx
xorl %esi, %esi
callq 0x63a0
movslq -0x10a4(%rbp), %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x1098(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x1098(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x1098(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x1098(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x1098(%rbp), %rsi
callq 0x7ed00
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x89d57
movq -0x1098(%rbp), %rdi
callq 0x7f750
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
jmp 0x89d59
movq -0x1098(%rbp), %rdi
callq 0x7f750
movq -0x10a0(%rbp), %rdi
callq 0x83b70
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0x81110
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x89d9e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x80e30
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x89dc7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xa1f60
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x89de4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x89deb
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1180, %rsp           # imm = 0x1180
popq %rbp
retq
nopw (%rax,%rax)