#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 json_object {
  int dummy;
};

/* Variables and functions */
char *json_object_get_string(int /*<<< orphan*/);
int /*<<< orphan*/ json_object_object_get(struct json_object *, char const *);
int strcmp(char const *, char const *);
int compar_asc(const void *context, const void *obj1, const void *obj2) {
  const char *val1;
  const char *val2;
  val1 = json_object_get_string(json_object_object_get(
      *(struct json_object **)obj1, (const char *)context));
  val2 = json_object_get_string(json_object_object_get(
      *(struct json_object **)obj2, (const char *)context));
  return strcmp(val1, val2);
}


x86 assembly (clang, -O0):
<compar_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <json_object_object_get@plt>
mov    %eax,%edi
call   1030 <json_object_get_string@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <json_object_object_get@plt>
mov    %eax,%edi
call   1030 <json_object_get_string@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compar_asc>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
mov    (%rsi),%rdi
mov    %rbx,%rsi
call   1050 <json_object_object_get@plt>
mov    %eax,%edi
call   1030 <json_object_get_string@plt>
mov    %rax,%r15
mov    (%r14),%rdi
mov    %rbx,%rsi
call   1050 <json_object_object_get@plt>
mov    %eax,%edi
call   1030 <json_object_get_string@plt>
mov    %r15,%rdi
mov    %rax,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcmp@plt>

LLVM IR (-O0):
%struct.json_object = type { i32 }
define i32 @compar_asc(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to %struct.json_object**
%11 = load %struct.json_object*, %struct.json_object** %10
%12 = load i8*, i8** %4
%13 = call i32 @json_object_object_get(%struct.json_object* %11, i8* %12)
%14 = call i8* @json_object_get_string(i32 %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %6
%16 = bitcast i8* %15 to %struct.json_object**
%17 = load %struct.json_object*, %struct.json_object** %16
%18 = load i8*, i8** %4
%19 = call i32 @json_object_object_get(%struct.json_object* %17, i8* %18)
%20 = call i8* @json_object_get_string(i32 %19)
store i8* %20, i8** %8
%21 = load i8*, i8** %7
%22 = load i8*, i8** %8
%23 = call i32 @strcmp(i8* %21, i8* %22)
ret i32 %23
}

LLVM IR (-O2):
%struct.json_object = type { i32 }
define i32 @compar_asc(i8* %0, i8* nocapture %1, i8* nocapture %2) {
%4 = bitcast i8* %1 to %struct.json_object**
%5 = load %struct.json_object*, %struct.json_object** %4
%6 = tail call i32 @json_object_object_get(%struct.json_object* %5, i8* %0)
%7 = tail call i8* @json_object_get_string(i32 %6)
%8 = bitcast i8* %2 to %struct.json_object**
%9 = load %struct.json_object*, %struct.json_object** %8
%10 = tail call i32 @json_object_object_get(%struct.json_object* %9, i8* %0)
%11 = tail call i8* @json_object_get_string(i32 %10)
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %7, i8* dereferenceable(1) %11)
ret i32 %12
}