// File: /workspace/github_c_makefile_star2_O1/dwbuiten[P]obuparse/obuparse.c
// Function: obp_read_global_param
static inline int _obp_read_global_param(_OBPBitReader *br, OBPFrameHeader *fh, uint8_t type, int ref, int idx, OBPError *err)
{
    uint8_t absBits  = 12;
    uint8_t precBits = 15;
    if (idx < 2) {
        if (type == 1) {
            absBits  = 9 - !fh->allow_high_precision_mv;
            precBits = 3 - !fh->allow_high_precision_mv;
        } else {
            absBits  = 12;
            precBits = 6;
        }
    }
    int32_t precDiff = 16 - precBits;
    int32_t round    = ((idx % 3) == 2) ? (1 << 16) : 0;
    int32_t sub      = ((idx % 3) == 2) ? (1 << precBits) : 0;
    int32_t mx       = (1 << absBits);
    int32_t r        = (fh->global_motion_params.prev_gm_params[ref][idx] >> precDiff) - sub;
    int16_t val;
    int ret = _obp_decode_signed_subexp_with_ref(br, -mx, mx + 1, r, &val, err);
    if (ret < 0) {
        return -1;
    }
    if (val < 0) { /* signed shifts are bad. */
        val                                          = -val;
        fh->global_motion_params.gm_params[ref][idx] = (-(val << precDiff) + round);
    } else {
        fh->global_motion_params.gm_params[ref][idx] = (val << precDiff) + round;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, 0x18(%rsp)
movl %ecx, %eax
movq %rdi, %r14
movl $0xc, %edi
movl $0xf, %ecx
cmpl $0x1, %r8d
jg 0xa01b
movl $0x6, %ecx
cmpb $0x1, %dl
jne 0xa01b
xorl %edi, %edi
cmpl $0x0, 0x104(%rsi)
sete %dil
movl %edi, %ecx
xorl $0x3, %ecx
xorl $0x9, %edi
movl $0x10, %r10d
subl %ecx, %r10d
imull $0xaaaaaaab, %r8d, %edx # imm = 0xAAAAAAAB
addl $0xaaaaaaaa, %edx       # imm = 0xAAAAAAAA
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
shll %cl, %r11d
xorl %ecx, %ecx
xorl %r9d, %r9d
cmpl $0x55555555, %edx       # imm = 0x55555555
cmovael %ecx, %r11d
setb %r9b
shll $0x10, %r9d
movl %r9d, 0x14(%rsp)
movl $0x1, %edx
movl %edi, %ecx
shll %cl, %edx
cltq
leaq (%rax,%rax,2), %rax
leaq (%rsi,%rax,8), %rax
movl %r8d, %ecx
movq %rax, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movl 0x2c8(%rax,%rcx,4), %eax
movl %r10d, 0x10(%rsp)
movl %r10d, %ecx
shrl %cl, %eax
leal 0x1(,%rdx,2), %ebp
movq %rdx, 0x58(%rsp)
addl %edx, %r11d
addl %eax, %r11d
movq %r11, 0x50(%rsp)
movl $0x3, %ebx
xorl %edx, %edx
movq %rax, 0x38(%rsp)
xorl %r15d, %r15d
movq %rax, 0x30(%rsp)
movq %r14, 0x40(%rsp)
leal 0x2(%r15), %r12d
testl %r15d, %r15d
cmovel %ebx, %r12d
movl $0x1, %r13d
movl %r12d, %ecx
shll %cl, %r13d
movl $0x3, %eax
shll %cl, %eax
addl %edx, %eax
cmpl %ebp, %eax
jge 0xa12c
movq %rdx, 0x48(%rsp)
movq %r15, 0x20(%rsp)
movl %ebp, %r15d
movzbl 0x20(%r14), %eax
movl $0x8, %ecx
subl %eax, %ecx
sarl $0x3, %ecx
movslq %ecx, %rbp
movq %r14, %rdi
movq 0x8(%r14), %r14
subq 0x10(%rdi), %r14
cmpq %rbp, %r14
jae 0xa162
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
leaq 0x1060(%rip), %rdx      # 0xb17d
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
jmp 0xa17c
movl %ebp, %esi
movq %rdx, %r12
subl %edx, %esi
movq %r14, %rdi
leaq 0x2c(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x9d36
movl %eax, %r8d
testl %eax, %eax
js 0xa154
movl 0x2c(%rsp), %eax
movl %eax, 0xc(%rsp)
sarl $0x1f, %r8d
xorl %eax, %eax
movq %r12, %rdx
jmp 0xa249
movl $0x1, %esi
movl %r8d, %ebx
callq 0x2cf9
movl %ebx, %r8d
movl $0x3, %ebx
movq %rax, 0x38(%rsp)
cmpq %rbp, %r14
movq 0x48(%rsp), %rdx
jae 0xa19a
xorl %eax, %eax
movl %r15d, %ebp
movq 0x40(%rsp), %r14
movq 0x20(%rsp), %r15
jmp 0xa249
cmpl $0x0, 0x38(%rsp)
movl %r15d, %ebp
movq 0x40(%rsp), %r14
je 0xa1be
movq 0x20(%rsp), %r15
incl %r15d
addl %edx, %r13d
movb $0x1, %al
movl %r13d, %edx
jmp 0xa249
cmpl $0x100, %r12d           # imm = 0x100
movq 0x20(%rsp), %r15
jge 0xa324
movzbl %r12b, %eax
movzbl 0x20(%r14), %ecx
subl %ecx, %eax
addl $0x7, %eax
sarl $0x3, %eax
cltq
movq 0x8(%r14), %r13
subq 0x10(%r14), %r13
movq %rax, 0x70(%rsp)
cmpq %rax, %r13
jae 0xa21c
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
leaq 0xf75(%rip), %rdx       # 0xb17d
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq 0x30(%rsp), %rax
jmp 0xa22b
movzbl %r12b, %esi
movq %r14, %rdi
callq 0x2cf9
xorl %r8d, %r8d
movq 0x48(%rsp), %rdx
movq %rax, 0x30(%rsp)
addl %edx, %eax
cmpq 0x70(%rsp), %r13
movl 0xc(%rsp), %ecx
cmovael %eax, %ecx
movl %ecx, 0xc(%rsp)
xorl %eax, %eax
testb %al, %al
jne 0xa0b7
testl %r8d, %r8d
js 0xa289
movq 0x50(%rsp), %rdx
testl %edx, %edx
js 0xa28b
leal (%rdx,%rdx), %eax
cmpl %ebp, %eax
movl 0xc(%rsp), %esi
jle 0xa29e
decl %ebp
movl %ebp, %eax
subl %edx, %eax
movl %esi, %ecx
leal (%rax,%rax), %edx
movslq %edx, %rdx
cmpq %rdx, %rcx
ja 0xa2c5
testb $0x1, %sil
jne 0xa2bd
shrl %esi
addl %eax, %esi
jmp 0xa2c5
jmp 0xa2c9
movl 0xc(%rsp), %esi
movl %esi, %eax
leal (%rdx,%rdx), %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jbe 0xa2a7
jmp 0xa2c9
movl %esi, %ecx
cltq
cmpq %rax, %rcx
ja 0xa2c9
testb $0x1, %sil
jne 0xa2b3
shrl %esi
addl %edx, %esi
jmp 0xa2c9
incl %esi
shrl %esi
subl %esi, %edx
movl %edx, %esi
jmp 0xa2c9
incl %esi
shrl %esi
subl %esi, %eax
movl %eax, %esi
subl %esi, %ebp
movl %ebp, %esi
testl %r8d, %r8d
js 0xa2e8
subl 0x58(%rsp), %esi
testw %si, %si
js 0xa2ef
movzwl %si, %eax
movl 0x10(%rsp), %ecx
shll %cl, %eax
movl 0x14(%rsp), %ecx
addl %eax, %ecx
jmp 0xa300
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xa315
negl %esi
movswl %si, %eax
movl 0x10(%rsp), %ecx
shll %cl, %eax
movl 0x14(%rsp), %ecx
subl %eax, %ecx
movl %ecx, %eax
movq 0x68(%rsp), %rcx
movq 0x60(%rsp), %rdx
movl %eax, 0x208(%rcx,%rdx,4)
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1252(%rip), %rdi      # 0xb57d
leaq 0xda9(%rip), %rsi       # 0xb0db
leaq 0x124e(%rip), %rcx      # 0xb587
movl $0xf3, %edx
callq 0x1040