// File: /workspace/github_c_makefile_star2_O3/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 0x2ead(%rip), %rdi      # 0xa999
leaq 0x48d(%rip), %rcx       # 0x7f80
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x2260
movl %eax, %r14d
movl %eax, 0x34(%rsp)
testl %eax, %eax
jle 0x7f41
leaq 0x2ec4(%rip), %r15      # 0xa9d9
xorl %r13d, %r13d
movq %r14, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq (%rax,%r13,8), %r12
cmpb $0x2e, 0x13(%r12)
je 0x7f35
addq $0x13, %r12
movl $0x20, %esi
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x2210
movq %rbx, %rdi
movl $0x80000, %esi          # imm = 0x80000
xorl %eax, %eax
callq 0x2420
testl %eax, %eax
js 0x7f35
movl %eax, %ebx
movl $0x200, %edx            # imm = 0x200
movl %eax, %edi
leaq 0x70(%rsp), %rsi
xorl %ecx, %ecx
callq 0x2480
testq %rax, %rax
js 0x7cd9
cmpb $0x55, 0x26e(%rsp)
jne 0x7cd9
cmpb $-0x56, 0x26f(%rsp)
jne 0x7cd9
cmpb $-0x12, 0x232(%rsp)
je 0x7cd9
movl %ebx, 0x4(%rsp)
movq %r13, 0x8(%rsp)
movl 0x228(%rsp), %ebp
movl $0x1, %edi
movl $0x60, %esi
callq 0x2300
movq %rax, %rbx
movq 0x18(%rsp), %r14
movq (%r14), %rax
movq %rax, (%rbx)
leaq 0xc(%rbx), %rdi
movl $0x20, %esi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%rbx), %rdi
movl $0x30, %esi
leaq 0x2de2(%rip), %rdx      # 0xa9e4
movl %ebp, 0x10(%rsp)
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2210
movq %rbx, (%r14)
movq %r12, %rdi
callq 0x2190
movq %r12, %r13
movb -0x1(%r12,%rax), %al
addb $-0x30, %al
cmpb $0xa, %al
leaq 0x17dc(%rip), %r14      # 0x9409
leaq 0x2777(%rip), %rax      # 0xa3ab
cmovbq %rax, %r14
movl $0x5, %r15d
leaq 0x262(%rsp), %r12
decl %r15d
cmpb $0x0, (%r12)
je 0x7cb5
movl $0x1, %edi
movl $0x60, %esi
callq 0x2300
movq %rax, %rbp
movq %rbx, (%rax)
movl $0x1, 0x8(%rax)
leaq 0xc(%rax), %rdi
movl $0x20, %esi
leaq 0x2d6d(%rip), %rdx      # 0xa9e9
movq %r13, %rcx
movq %r14, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%rbp), %rdi
movl $0x30, %esi
leaq 0x2d5c(%rip), %rdx      # 0xa9f8
movl 0x10(%rsp), %ecx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x2210
movq 0x18(%rsp), %rax
movq %rbp, (%rax)
movq %rbp, %rbx
addq $-0x10, %r12
cmpl $0x1, %r15d
ja 0x7c46
movq 0x20(%rsp), %r14
leaq 0x2d0e(%rip), %r15      # 0xa9d9
movq 0x8(%rsp), %r13
movl 0x4(%rsp), %ebx
jmp 0x7f2e
movq %r12, 0x8(%rsp)
movl $0x200, %edx            # imm = 0x200
movl %ebx, %edi
leaq 0x70(%rsp), %rsi
xorl %ecx, %ecx
callq 0x2480
testq %rax, %rax
js 0x7f2e
cmpb $0x55, 0x26e(%rsp)
jne 0x7f2e
cmpb $-0x56, 0x26f(%rsp)
jne 0x7f2e
cmpb $-0x12, 0x232(%rsp)
jne 0x7f2e
movl $0x200, %edx            # imm = 0x200
movl $0x200, %ecx            # imm = 0x200
movl %ebx, %edi
leaq 0x70(%rsp), %rsi
callq 0x2480
testq %rax, %rax
js 0x7f2e
movabsq $0x5452415020494645, %rax # imm = 0x5452415020494645
cmpq %rax, 0x70(%rsp)
jne 0x7f2e
movl $0x1, %edi
movl $0x60, %esi
callq 0x2300
movl %ebx, 0x4(%rsp)
movq %rax, %rbx
movq 0x18(%rsp), %r15
movq (%r15), %rax
movq %rax, (%rbx)
leaq 0xc(%rbx), %rdi
movl $0x20, %esi
leaq 0x2c50(%rip), %rdx      # 0xa9d9
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x2c(%rbx), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x80cb
movq %rbx, (%r15)
movl 0x4(%rsp), %ebx
leaq 0x2c25(%rip), %r15      # 0xa9d9
movl 0xc0(%rsp), %r12d
cmpl $0x100, %r12d           # imm = 0x100
ja 0x7f2e
movl 0xc4(%rsp), %r14d
movq %r14, 0x38(%rsp)
imull %r12d, %r14d
movq %r14, %rdi
callq 0x2380
movq %rax, %rbp
movl $0x400, %ecx            # imm = 0x400
movl %ebx, %edi
movq %rax, %rsi
movq %r14, %rdx
callq 0x2480
testq %rax, %rax
js 0x7f21
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x2190
movb -0x1(%rbx,%rax), %al
addb $-0x30, %al
cmpb $0xa, %al
leaq 0x15ed(%rip), %rcx      # 0x9409
leaq 0x2588(%rip), %rax      # 0xa3ab
cmovbq %rax, %rcx
movq %rcx, 0x48(%rsp)
testl %r12d, %r12d
movq 0x38(%rsp), %rdx
movq %rbp, %rdi
je 0x7f12
leaq (%rdi,%r14), %rax
movq %rax, 0x10(%rsp)
subq %rdx, %r14
negq %rdx
addq %rdi, %r14
incq %r14
movq %rdi, 0x40(%rsp)
movq 0x10(%rsp), %rbp
cmpb $0x0, (%rbp,%rdx)
leaq (%rbp,%rdx), %rax
movq %rax, 0x10(%rsp)
je 0x7eea
movl $0x1, %edi
movl $0x60, %esi
movq %rdx, %rbp
callq 0x2300
movq %rax, %rbx
movq 0x18(%rsp), %r15
movq (%r15), %rax
movq %rax, (%rbx)
movl $0x1, 0x8(%rbx)
leaq 0xc(%rbx), %rdi
movl $0x20, %esi
leaq 0x2b45(%rip), %rdx      # 0xa9e9
movq 0x8(%rsp), %rcx
movq 0x48(%rsp), %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x2210
movq 0x10(%rsp), %rax
leaq 0x10(%rax), %rdi
leaq 0x2c(%rbx), %rsi
callq 0x80cb
movq 0x40(%rsp), %rdi
movq %rbp, %rdx
movq %rbx, (%r15)
leaq 0x2afd(%rip), %r15      # 0xa9d9
addq %rdx, %r14
decl %r12d
jne 0x7e57
jmp 0x7f12
movq $-0x1, %rax
cmpq $0xe, %rax
je 0x7edc
leaq 0x1(%rax), %rcx
cmpb $0x0, 0x1(%r14,%rax)
movq %rcx, %rax
je 0x7ef1
cmpq $0xe, %rcx
jbe 0x7e6d
jmp 0x7edc
callq 0x2040
movq 0x20(%rsp), %r14
jmp 0x7cd0
movq %rbp, %rdi
callq 0x2040
movq 0x20(%rsp), %r14
movl %ebx, %edi
callq 0x2280
incq %r13
cmpq %r14, %r13
jne 0x7b1d
cmpl $0x0, 0x34(%rsp)
js 0x7f6c
je 0x7f62
xorl %ebx, %ebx
movq 0x28(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2040
incq %rbx
cmpq %rbx, %r14
jne 0x7f4c
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