#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
int atoi(int /*<<< orphan*/);
int numbersort(const struct dirent **a, const struct dirent **b) {
  int left = atoi((*a)->d_name);
  int right = atoi((*b)->d_name);
  if (left < right)
    return -1;
  else if (left > right)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<numbersort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1030 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1030 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    115a <numbersort+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <numbersort+0x69>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1172 <numbersort+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1179 <numbersort+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbersort>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rdi),%rax
mov    (%rax),%edi
call   1030 <atoi@plt>
mov    %eax,%ebp
mov    (%rbx),%rax
mov    (%rax),%edi
call   1030 <atoi@plt>
xor    %ecx,%ecx
cmp    %eax,%ebp
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @numbersort(%struct.dirent** %0, %struct.dirent** %1) {
%3 = alloca i32
%4 = alloca %struct.dirent**
%5 = alloca %struct.dirent**
%6 = alloca i32
%7 = alloca i32
store %struct.dirent** %0, %struct.dirent*** %4
store %struct.dirent** %1, %struct.dirent*** %5
%8 = load %struct.dirent**, %struct.dirent*** %4
%9 = load %struct.dirent*, %struct.dirent** %8
%10 = getelementptr inbounds %struct.dirent, %struct.dirent* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @atoi(i32 %11)
store i32 %12, i32* %6
%13 = load %struct.dirent**, %struct.dirent*** %5
%14 = load %struct.dirent*, %struct.dirent** %13
%15 = getelementptr inbounds %struct.dirent, %struct.dirent* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 @atoi(i32 %16)
store i32 %17, i32* %7
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %2
store i32 -1, i32* %3
br label %28
22: ; preds = %2
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 1, i32* %3
br label %28
27: ; preds = %22
store i32 0, i32* %3
br label %28
28: ; preds = %27, %26, %21
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @numbersort(%struct.dirent** nocapture %0, %struct.dirent** nocapture %1) {
%3 = load %struct.dirent*, %struct.dirent** %0
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @atoi(i32 %5)
%7 = load %struct.dirent*, %struct.dirent** %1
%8 = getelementptr inbounds %struct.dirent, %struct.dirent* %7, i64 0, i32 0
%9 = load i32, i32* %8
%10 = tail call i32 @atoi(i32 %9)
%11 = icmp slt i32 %6, %10
%12 = icmp sgt i32 %6, %10
%13 = zext i1 %12 to i32
%14 = select i1 %11, i32 -1, i32 %13
ret i32 %14
}