#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 slRef {
  int dummy;
};
struct lm {
  int dummy;
};
struct jsonElement {
  int dummy;
};
struct hash {
  int dummy;
};

/* Variables and functions */
struct jsonElement *hashFindVal(struct hash *, char *);
struct hash *jsonObjectVal(struct jsonElement *, char *);
int /*<<< orphan*/ rQueryElement(struct jsonElement *, char *, char *,
                                 struct slRef **, struct lm *);
void rQueryObject(struct jsonElement *el, char *name, char *id, char *path,
                  struct slRef **pResultList, struct lm *lm) {
  struct hash *hash = jsonObjectVal(el, name);
  if (hash) {
    struct jsonElement *child = hashFindVal(hash, id);
    if (child)
      rQueryElement(child, name, path, pResultList, lm);
  }
}


x86 assembly (clang, -O0):
<rQueryObject>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <jsonObjectVal@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11a6 <rQueryObject+0x76>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <hashFindVal@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     11a1 <rQueryObject+0x71>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1050 <rQueryElement@plt>
jmp    11a6 <rQueryObject+0x76>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rQueryObject>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
call   1040 <jsonObjectVal@plt>
test   %rax,%rax
je     117f <rQueryObject+0x4f>
mov    %rax,%rdi
mov    %r13,%rsi
call   1030 <hashFindVal@plt>
test   %rax,%rax
je     117f <rQueryObject+0x4f>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <rQueryElement@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.jsonElement = type { i32 }
%struct.slRef = type { i32 }
%struct.lm = type { i32 }
%struct.hash = type { i32 }
define void @rQueryObject(%struct.jsonElement* %0, i8* %1, i8* %2, i8* %3, %struct.slRef** %4, %struct.lm* %5) {
%7 = alloca %struct.jsonElement*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca %struct.slRef**
%12 = alloca %struct.lm*
%13 = alloca %struct.hash*
%14 = alloca %struct.jsonElement*
store %struct.jsonElement* %0, %struct.jsonElement** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store %struct.slRef** %4, %struct.slRef*** %11
store %struct.lm* %5, %struct.lm** %12
%15 = load %struct.jsonElement*, %struct.jsonElement** %7
%16 = load i8*, i8** %8
%17 = call %struct.hash* @jsonObjectVal(%struct.jsonElement* %15, i8* %16)
store %struct.hash* %17, %struct.hash** %13
%18 = load %struct.hash*, %struct.hash** %13
%19 = icmp ne %struct.hash* %18, null
br i1 %19, label %20, label %34
20: ; preds = %6
%21 = load %struct.hash*, %struct.hash** %13
%22 = load i8*, i8** %9
%23 = call %struct.jsonElement* @hashFindVal(%struct.hash* %21, i8* %22)
store %struct.jsonElement* %23, %struct.jsonElement** %14
%24 = load %struct.jsonElement*, %struct.jsonElement** %14
%25 = icmp ne %struct.jsonElement* %24, null
br i1 %25, label %26, label %33
26: ; preds = %20
%27 = load %struct.jsonElement*, %struct.jsonElement** %14
%28 = load i8*, i8** %8
%29 = load i8*, i8** %10
%30 = load %struct.slRef**, %struct.slRef*** %11
%31 = load %struct.lm*, %struct.lm** %12
%32 = call i32 @rQueryElement(%struct.jsonElement* %27, i8* %28, i8* %29, %struct.slRef** %30, %struct.lm* %31)
br label %33
33: ; preds = %26, %20
br label %34
34: ; preds = %33, %6
ret void
}

LLVM IR (-O2):
%struct.jsonElement = type { i32 }
%struct.slRef = type { i32 }
%struct.lm = type { i32 }
%struct.hash = type { i32 }
define void @rQueryObject(%struct.jsonElement* %0, i8* %1, i8* %2, i8* %3, %struct.slRef** %4, %struct.lm* %5) {
%7 = tail call %struct.hash* @jsonObjectVal(%struct.jsonElement* %0, i8* %1)
%8 = icmp eq %struct.hash* %7, null
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = tail call %struct.jsonElement* @hashFindVal(%struct.hash* %7, i8* %2)
%11 = icmp eq %struct.jsonElement* %10, null
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @rQueryElement(%struct.jsonElement* %10, i8* %1, i8* %3, %struct.slRef** %4, %struct.lm* %5)
br label %14
14: ; preds = %9, %12, %6
ret void
}