// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movq $0x0, (%rdi)
leaq 0x2b9d(%rip), %rdi      # 0xa979
leaq 0x537(%rip), %rcx       # 0x831a
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x2260
movl %eax, %r13d
movl %eax, 0x34(%rsp)
testl %eax, %eax
jle 0x82db
leaq 0x2bb4(%rip), %rbp      # 0xa9b9
leaq 0x50(%rsp), %r14
leaq 0x70(%rsp), %r15
xorl %ebx, %ebx
movq %r13, 0x48(%rsp)
movq 0x28(%rsp), %rax
movq (%rax,%rbx,8), %rcx
cmpb $0x2e, 0x13(%rcx)
je 0x82cf
addq $0x13, %rcx
movl $0x20, %esi
movq %r14, %rdi
movq %rbp, %rdx
movq %rcx, 0x10(%rsp)
xorl %eax, %eax
callq 0x2210
movq %r14, %rdi
movl $0x80000, %esi          # imm = 0x80000
xorl %eax, %eax
callq 0x2410
testl %eax, %eax
js 0x82cf
movl %eax, %r12d
movl $0x200, %edx            # imm = 0x200
movl %eax, %edi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x2470
testq %rax, %rax
movl %r12d, 0x4(%rsp)
js 0x8013
cmpb $0x55, 0x26e(%rsp)
jne 0x8013
cmpb $-0x56, 0x26f(%rsp)
jne 0x8013
cmpb $-0x12, 0x232(%rsp)
je 0x8013
movq %rbx, 0x8(%rsp)
movl 0x228(%rsp), %r13d
movl $0x60, %edi
callq 0x2370
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq 0x18(%rsp), %r15
movq (%r15), %rax
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
leaq 0xc(%r14), %rdi
movl $0x20, %esi
movq %rbp, %rdx
movq 0x10(%rsp), %r12
movq %r12, %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%r14), %rdi
movl $0x30, %esi
leaq 0x2aab(%rip), %rdx      # 0xa9c4
movl %r13d, %ebx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2210
movq %r14, (%r15)
movq %r12, %rdi
callq 0x2190
movb -0x1(%r12,%rax), %al
addb $-0x30, %al
cmpb $0xa, %al
leaq 0x14c8(%rip), %rbp      # 0x9409
leaq 0x2463(%rip), %rax      # 0xa3ab
cmovbq %rax, %rbp
movl $0x5, %r14d
leaq 0x262(%rsp), %r13
decl %r14d
cmpb $0x0, (%r13)
je 0x7fe1
movl $0x60, %edi
callq 0x2370
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq 0x18(%rsp), %r12
movq (%r12), %rax
movq %rax, (%r15)
movl $0x1, 0x8(%r15)
leaq 0xc(%r15), %rdi
movl $0x20, %esi
leaq 0x2a1a(%rip), %rdx      # 0xa9c9
movq 0x10(%rsp), %rcx
movq %rbp, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%r15), %rdi
movl $0x30, %esi
leaq 0x2a07(%rip), %rdx      # 0xa9d8
movl %ebx, %ecx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x2210
movq %r15, (%r12)
addq $-0x10, %r13
cmpl $0x1, %r14d
ja 0x7f5a
movq 0x48(%rsp), %r13
leaq 0x29be(%rip), %rbp      # 0xa9b9
leaq 0x50(%rsp), %r14
leaq 0x70(%rsp), %r15
movl 0x4(%rsp), %edi
movq 0x8(%rsp), %rbx
jmp 0x82ca
movl $0x200, %edx            # imm = 0x200
movl %r12d, %edi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x2470
testq %rax, %rax
js 0x82c6
cmpb $0x55, 0x26e(%rsp)
jne 0x82c6
cmpb $-0x56, 0x26f(%rsp)
jne 0x82c6
cmpb $-0x12, 0x232(%rsp)
jne 0x82c6
movl $0x200, %edx            # imm = 0x200
movl $0x200, %ecx            # imm = 0x200
movl 0x4(%rsp), %edi
movq %r15, %rsi
callq 0x2470
testq %rax, %rax
js 0x82c6
cmpb $0x45, 0x70(%rsp)
jne 0x82c6
cmpb $0x46, 0x71(%rsp)
jne 0x82c6
cmpb $0x49, 0x72(%rsp)
jne 0x82c6
cmpb $0x20, 0x73(%rsp)
jne 0x82c6
cmpb $0x50, 0x74(%rsp)
jne 0x82c6
cmpb $0x41, 0x75(%rsp)
jne 0x82c6
cmpb $0x52, 0x76(%rsp)
jne 0x82c6
cmpb $0x54, 0x77(%rsp)
jne 0x82c6
movl $0x60, %edi
callq 0x2370
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq 0x18(%rsp), %r15
movq (%r15), %rax
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
leaq 0xc(%r14), %rdi
movl $0x20, %esi
movq %rbp, %rdx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%r14), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x846b
movq %r14, (%r15)
leaq 0x70(%rsp), %r15
leaq 0x50(%rsp), %r14
movl 0xc0(%rsp), %r12d
cmpl $0x100, %r12d           # imm = 0x100
ja 0x82c6
movl 0xc4(%rsp), %ebp
movl %ebp, %r14d
imull %r12d, %r14d
movq %r14, %rdi
callq 0x2370
movl $0x400, %ecx            # imm = 0x400
movl 0x4(%rsp), %edi
movq %rax, 0x38(%rsp)
movq %rax, %rsi
movq %r14, %rdx
callq 0x2470
testq %rax, %rax
js 0x82b0
movl %ebp, 0x20(%rsp)
movq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x2190
movb -0x1(%rbp,%rax), %al
movl 0x20(%rsp), %edx
addb $-0x30, %al
cmpb $0xa, %al
leaq 0x1259(%rip), %rcx      # 0x9409
leaq 0x21f4(%rip), %rax      # 0xa3ab
cmovbq %rax, %rcx
movq %rcx, 0x40(%rsp)
testl %r12d, %r12d
je 0x82b0
movq 0x38(%rsp), %rax
leaq (%rax,%r14), %rcx
movq %rcx, 0x8(%rsp)
movl %edx, %edx
subq %rdx, %r14
negq %rdx
leaq (%rax,%r14), %rbp
incq %rbp
movq %rdx, 0x20(%rsp)
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax,%rdx)
leaq (%rax,%rdx), %rax
movq %rax, 0x8(%rsp)
jne 0x8227
movq $-0x1, %rax
cmpq $0xe, %rax
je 0x821c
leaq 0x1(%rax), %rcx
cmpb $0x0, 0x1(%rbp,%rax)
movq %rcx, %rax
je 0x8206
jmp 0x8221
movl $0xf, %ecx
cmpq $0xe, %rcx
ja 0x82a4
movl $0x60, %edi
callq 0x2370
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq 0x18(%rsp), %r15
movq (%r15), %rax
movq %rax, (%r14)
movl $0x1, 0x8(%r14)
leaq 0xc(%r14), %rdi
movl $0x20, %esi
leaq 0x2758(%rip), %rdx      # 0xa9c9
movq 0x10(%rsp), %rcx
movq 0x40(%rsp), %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x2210
movq 0x8(%rsp), %rax
leaq 0x10(%rax), %rdi
leaq 0x2c(%r14), %rsi
callq 0x846b
movq 0x20(%rsp), %rdx
movq %r14, (%r15)
leaq 0x70(%rsp), %r15
addq %rdx, %rbp
decl %r12d
jne 0x81eb
movq 0x38(%rsp), %rdi
callq 0x2040
leaq 0x26f8(%rip), %rbp      # 0xa9b9
leaq 0x50(%rsp), %r14
movl 0x4(%rsp), %edi
callq 0x2280
incq %rbx
cmpq %r13, %rbx
jne 0x7e16
cmpl $0x0, 0x34(%rsp)
js 0x8306
je 0x82fc
xorl %ebx, %ebx
movq 0x28(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2040
incq %rbx
cmpq %rbx, %r13
jne 0x82e6
movq 0x28(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq