#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char **, char *, char *);
int strcmp(char *, char *);
int compare_names(const void *a, const void *b) {
  char **sa = (char **)a;
  char **sb = (char **)b;
  printf("%s %p %p %s %s\n", *sa, *sa, sa, sa[0], sa[1]);
  printf("%s %p %p %s %s\n", *sb, *sb, sb, sb[0], sb[1]);
  return strcmp(*sa, *sb);
}


x86 assembly (clang, -O0):
<compare_names>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r9
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    (%rax),%r8
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r9
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_names>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdx
mov    0x8(%rdi),%r9
lea    0xec7(%rip),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %rbx,%rcx
mov    %rdx,%r8
call   1030 <printf@plt>
mov    (%r14),%rdx
mov    0x8(%r14),%r9
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %r14,%rcx
mov    %rdx,%r8
call   1030 <printf@plt>
mov    (%rbx),%rdi
mov    (%r14),%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcmp@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%s %p %p %s %s\0A\00"
define i32 @compare_names(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %5
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %5
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %14, i8** %15, i8* %18, i8* %21)
%23 = load i8**, i8*** %6
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %6
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %6
%28 = load i8**, i8*** %6
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %6
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %26, i8** %27, i8* %30, i8* %33)
%35 = load i8**, i8*** %5
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %6
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %36, i8* %38)
ret i32 %39
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s %p %p %s %s\0A\00"
define i32 @compare_names(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %5, i8** %3, i8* %5, i8* %8)
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %1, i64 8
%12 = bitcast i8* %11 to i8**
%13 = load i8*, i8** %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %10, i8** %4, i8* %10, i8* %13)
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %15, i8* dereferenceable(1) %16)
ret i32 %17
}