#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 /*<<< orphan*/ _DIAGASSERT(int /*<<< orphan*/);
int strcmp(int /*<<< orphan*/, int /*<<< orphan*/);
int alphasort(const struct dirent **d1, const struct dirent **d2) {
  _DIAGASSERT(d1 != NULL);
  _DIAGASSERT(d2 != NULL);
  return (strcmp((*(const struct dirent *const *)d1)->d_name,
                 (*(const struct dirent *const *)d2)->d_name));
}


x86 assembly (clang, -O0):
<alphasort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <_DIAGASSERT@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <_DIAGASSERT@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
call   1030 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphasort>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <_DIAGASSERT@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <_DIAGASSERT@plt>
mov    (%rbx),%rax
mov    (%rax),%edi
mov    (%r14),%rax
mov    (%rax),%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @alphasort(%struct.dirent** %0, %struct.dirent** %1) {
%3 = alloca %struct.dirent**
%4 = alloca %struct.dirent**
store %struct.dirent** %0, %struct.dirent*** %3
store %struct.dirent** %1, %struct.dirent*** %4
%5 = load %struct.dirent**, %struct.dirent*** %3
%6 = icmp ne %struct.dirent** %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @_DIAGASSERT(i32 %7)
%9 = load %struct.dirent**, %struct.dirent*** %4
%10 = icmp ne %struct.dirent** %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @_DIAGASSERT(i32 %11)
%13 = load %struct.dirent**, %struct.dirent*** %3
%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 = load %struct.dirent**, %struct.dirent*** %4
%18 = load %struct.dirent*, %struct.dirent** %17
%19 = getelementptr inbounds %struct.dirent, %struct.dirent* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i32 @strcmp(i32 %16, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @alphasort(%struct.dirent** %0, %struct.dirent** %1) {
%3 = icmp ne %struct.dirent** %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @_DIAGASSERT(i32 %4)
%6 = icmp ne %struct.dirent** %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @_DIAGASSERT(i32 %7)
%9 = load %struct.dirent*, %struct.dirent** %0
%10 = getelementptr inbounds %struct.dirent, %struct.dirent* %9, i64 0, i32 0
%11 = load i32, i32* %10
%12 = load %struct.dirent*, %struct.dirent** %1
%13 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i64 0, i32 0
%14 = load i32, i32* %13
%15 = tail call i32 @strcmp(i32 %11, i32 %14)
ret i32 %15
}