// File: /workspace/github_c_makefile_star2_O0/adsr[P]phpspy/./phpspy_trace.c
// Function: copy_zarray_bucket_70
static int copy_zarray_bucket(trace_context_t *context, zend_array *rzarray, const char *key, Bucket *lbucket) {
    int rv;
    zend_array lzarray;
    uint32_t hash_table_size;
    uint64_t hash_val;
    uint32_t hash_index;
    uint32_t hash_table_val;
    uint32_t *hash_bucket;
    char tmp_key[PHPSPY_STR_SIZE];
    size_t tmp_len;

    try_copy_proc_mem("array", rzarray, &lzarray, sizeof(lzarray));

    hash_val = phpspy_zend_inline_hash_func(key, strlen(key));
    hash_table_size = (uint32_t)(-1 * (int32_t)lzarray.nTableMask);
    hash_index = hash_val % hash_table_size;

    try_copy_proc_mem("hash_table_val", ((uint32_t*)lzarray.arData) - hash_table_size + hash_index, &hash_table_val, sizeof(uint32_t));

    hash_bucket = &hash_table_val;

    do {
        if (*hash_bucket == (uint32_t)-1) return PHPSPY_ERR;

        /* Copy the next bucket from array data */
        try_copy_proc_mem("bucket", lzarray.arData + *hash_bucket, lbucket, sizeof(Bucket));

        if (lbucket->key == NULL) {
            break;
        }

        /* On hash collision, advance to the next bucket */
        try(rv, sprint_zstring(context, "array_key", lbucket->key, tmp_key, sizeof(tmp_key), &tmp_len));

        if (strcmp(key, tmp_key) == 0) {
            hash_bucket = NULL;
        } else {
            hash_bucket = &lbucket->val.u2.next;
        }
    } while (hash_bucket);

    return PHPSPY_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rdx
leaq 0x2058a(%rip), %rsi     # 0x34fe6
leaq -0x50(%rbp), %rcx
movl $0x24, %r8d
callq 0x12680
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x14a7e
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14bff
jmp 0x14a80
movq -0x20(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6160
movq -0x180(%rbp), %rdi
movq %rax, %rsi
callq 0xc1a0
movq %rax, -0x60(%rbp)
imull $0xffffffff, -0x44(%rbp), %eax # imm = 0xFFFFFFFF
movl %eax, -0x54(%rbp)
movq -0x60(%rbp), %rax
movl -0x54(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x40(%rbp), %rdx
movl -0x54(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
shlq $0x2, %rax
addq %rax, %rdx
movl -0x64(%rbp), %eax
shlq $0x2, %rax
addq %rax, %rdx
leaq 0x20551(%rip), %rsi     # 0x3503f
leaq -0x68(%rbp), %rcx
movl $0x4, %r8d
callq 0x12680
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x14b10
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14bff
jmp 0x14b12
leaq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x14b2f
movl $0x1, -0x4(%rbp)
jmp 0x14bff
jmp 0x14b31
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x40(%rbp), %rdx
movq -0x70(%rbp), %rax
movl (%rax), %eax
shlq $0x5, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rcx
leaq 0x204fb(%rip), %rsi     # 0x3504e
movl $0x20, %r8d
callq 0x12680
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x14b71
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14bff
jmp 0x14b73
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x14b80
jmp 0x14bf8
jmp 0x14b82
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdx
leaq -0x170(%rbp), %rcx
leaq 0x20458(%rip), %rsi     # 0x34ff4
movl $0x100, %r8d            # imm = 0x100
leaq -0x178(%rbp), %r9
callq 0x13140
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x14bbe
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14bff
jmp 0x14bc0
movq -0x20(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x6310
cmpl $0x0, %eax
jne 0x14bdf
movq $0x0, -0x70(%rbp)
jmp 0x14beb
movq -0x28(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x70(%rbp)
jmp 0x14bed
cmpq $0x0, -0x70(%rbp)
jne 0x14b1a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopl (%rax,%rax)