// File: /workspace/github_c_makefile_star2_O2/nerves-project[P]nerves_initramfs/src/block_device.c
// Function: probe_block_devices
int probe_block_devices(struct block_device_info **devices)
{
    *devices = NULL;

    struct dirent **namelist;
    int n = scandir("/sys/block",
                    &namelist,
                    NULL,
                    reverse_alphasort);
    int i;
    for (i = 0; i < n; i++) {
        if (namelist[i]->d_name[0] == '.')
            continue;

        probe_partitions(namelist[i]->d_name, devices);
    }

    if (n >= 0) {
        for (i = 0; i < n; i++)
            free(namelist[i]);
        free(namelist);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x28(%rsp)
andq $0x0, (%rdi)
leaq 0x2868(%rip), %rdi      # 0x99a9
leaq 0x3f0(%rip), %rcx       # 0x7538
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x2260
movl %eax, %ebp
testl %eax, %eax
movl $0x0, %r12d
cmovgl %eax, %r12d
leaq 0x2880(%rip), %r13      # 0x99e9
leaq 0x50(%rsp), %r15
leaq 0x70(%rsp), %rbx
xorl %r14d, %r14d
movl %eax, 0x24(%rsp)
movq %r12, 0x30(%rsp)
cmpq %r12, %r14
je 0x74fe
movq 0x38(%rsp), %rax
movq (%rax,%r14,8), %rcx
cmpb $0x2e, 0x13(%rcx)
je 0x74ec
addq $0x13, %rcx
movq %r15, %rdi
pushq $0x20
popq %rsi
movq %r13, %rdx
movq %rcx, 0x18(%rsp)
xorl %eax, %eax
callq 0x2210
movq %r15, %rdi
movl $0x80000, %esi          # imm = 0x80000
xorl %eax, %eax
callq 0x2420
testl %eax, %eax
js 0x74ec
movl $0x200, %edx            # imm = 0x200
movl %eax, 0xc(%rsp)
movl %eax, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x2480
testq %rax, %rax
js 0x72fa
cmpb $0x55, 0x26e(%rsp)
jne 0x72fa
cmpb $-0x56, 0x26f(%rsp)
jne 0x72fa
cmpb $-0x12, 0x232(%rsp)
je 0x72fa
movq %r14, 0x10(%rsp)
movl 0x228(%rsp), %ebp
callq 0x768f
movq %rax, %rbx
movq 0x28(%rsp), %r14
movq (%r14), %rax
movq %rax, (%rbx)
andl $0x0, 0x8(%rbx)
leaq 0xc(%rbx), %rdi
pushq $0x20
popq %rsi
movq %r13, %rdx
movq 0x18(%rsp), %r15
movq %r15, %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%rbx), %rdi
pushq $0x30
popq %rsi
leaq 0x2797(%rip), %rdx      # 0x99f4
movl %ebp, 0x8(%rsp)
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2210
movq %rbx, (%r14)
movq %r15, %rdi
callq 0x766a
movq %rax, %r13
leaq 0x262(%rsp), %r12
pushq $0x4
popq %r14
movl %r14d, %r15d
subl $0x1, %r15d
jb 0x74c4
cmpb $0x0, (%r12)
je 0x72f1
callq 0x768f
movq %rax, %rbp
movq %rbx, (%rax)
movl $0x1, 0x8(%rax)
leaq 0xc(%rax), %rdi
pushq $0x20
popq %rsi
leaq 0x2741(%rip), %rdx      # 0x99f9
movq 0x18(%rsp), %rcx
movq %r13, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%rbp), %rdi
pushq $0x30
popq %rsi
leaq 0x2730(%rip), %rdx      # 0x9a08
movl 0x8(%rsp), %ecx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x2210
movq 0x28(%rsp), %rax
movq %rbp, (%rax)
movq %rbp, %rbx
addq $-0x10, %r12
movl %r15d, %r14d
jmp 0x7287
movl $0x200, %edx            # imm = 0x200
movl 0xc(%rsp), %edi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x2480
testq %rax, %rax
js 0x74e3
cmpb $0x55, 0x26e(%rsp)
jne 0x74e3
cmpb $-0x56, 0x26f(%rsp)
jne 0x74e3
cmpb $-0x12, 0x232(%rsp)
jne 0x74e3
movl $0x200, %edx            # imm = 0x200
movl $0x200, %ecx            # imm = 0x200
movl 0xc(%rsp), %edi
movq %rbx, %rsi
callq 0x2480
testq %rax, %rax
js 0x74e3
movabsq $0x5452415020494645, %rax # imm = 0x5452415020494645
cmpq %rax, 0x70(%rsp)
jne 0x74e3
callq 0x768f
movq %rax, %rbx
movq %r14, 0x10(%rsp)
movq 0x28(%rsp), %r14
movq (%r14), %rax
movq %rax, (%rbx)
andl $0x0, 0x8(%rbx)
leaq 0xc(%rbx), %rdi
pushq $0x20
popq %rsi
movq %r13, %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%rbx), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x769a
movq %rbx, (%r14)
movq 0x10(%rsp), %r14
leaq 0x70(%rsp), %rbx
movl 0xc0(%rsp), %eax
cmpl $0x100, %eax            # imm = 0x100
ja 0x74e3
movl 0xc4(%rsp), %r15d
movl %r15d, %r14d
imull %eax, %r14d
movq %r14, %rdi
movl %eax, 0x8(%rsp)
callq 0x2380
movq %rax, %rbx
movl $0x400, %ecx            # imm = 0x400
movl 0xc(%rsp), %edi
movq %rax, %rsi
movq %r14, %rdx
callq 0x2480
testq %rax, %rax
js 0x74f4
movq 0x18(%rsp), %rdi
callq 0x766a
movq %rax, 0x40(%rsp)
leaq (%rbx,%r14), %r13
subq %r15, %r14
negq %r15
addq %rbx, %r14
movl 0x8(%rsp), %ecx
movl %ecx, %ebp
movq %r15, 0x48(%rsp)
subl $0x1, %ebp
jb 0x74bc
addq %r15, %r13
xorl %eax, %eax
cmpq $0x10, %rax
je 0x74b2
cmpb $0x0, (%r14,%rax)
leaq 0x1(%rax), %rax
je 0x7442
movl %ecx, 0x8(%rsp)
callq 0x768f
movq %rbx, %r15
movq %rax, %rbx
movq 0x28(%rsp), %r12
movq (%r12), %rax
movq %rax, (%rbx)
movl $0x1, 0x8(%rbx)
leaq 0xc(%rbx), %rdi
pushq $0x20
popq %rsi
leaq 0x2576(%rip), %rdx      # 0x99f9
movq 0x18(%rsp), %rcx
movq 0x40(%rsp), %r8
movl 0x8(%rsp), %r9d
xorl %eax, %eax
callq 0x2210
leaq 0x10(%r13), %rdi
leaq 0x2c(%rbx), %rsi
callq 0x769a
movq %rbx, (%r12)
movq %r15, %rbx
movq 0x48(%rsp), %r15
addq %r15, %r14
movl %ebp, %ecx
jmp 0x7438
movq %rbx, %rdi
callq 0x2040
movl 0x24(%rsp), %ebp
movq 0x30(%rsp), %r12
leaq 0x2515(%rip), %r13      # 0x99e9
leaq 0x50(%rsp), %r15
leaq 0x70(%rsp), %rbx
movq 0x10(%rsp), %r14
movl 0xc(%rsp), %edi
callq 0x2280
incq %r14
jmp 0x717f
movq %rbx, %rdi
callq 0x2040
jmp 0x74d4
testl %ebp, %ebp
js 0x7524
movl %ebp, %ebx
xorl %r14d, %r14d
movq 0x38(%rsp), %rdi
cmpq %r14, %rbx
je 0x751f
movq (%rdi,%r14,8), %rdi
callq 0x2040
incq %r14
jmp 0x7507
callq 0x2040
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq