#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 jx {
  int dummy;
};
struct ds_resources {
  int dummy;
};

/* Variables and functions */
struct ds_resources *ds_resources_create(int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ jx_lookup_integer(struct jx *, char *);
struct ds_resources *ds_resources_create_from_jx(struct jx *jresources) {
  return ds_resources_create(jx_lookup_integer(jresources, "cores"),
                             jx_lookup_integer(jresources, "memory"),
                             jx_lookup_integer(jresources, "disk"));
}


x86 assembly (clang, -O0):
<ds_resources_create_from_jx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <jx_lookup_integer@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1040 <jx_lookup_integer@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <jx_lookup_integer@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    %eax,%edx
call   1030 <ds_resources_create@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds_resources_create_from_jx>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed2(%rip),%rsi
call   1040 <jx_lookup_integer@plt>
mov    %eax,%r14d
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
call   1040 <jx_lookup_integer@plt>
mov    %eax,%ebp
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <jx_lookup_integer@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ds_resources_create@plt>

LLVM IR (-O0):
%struct.ds_resources = type { i32 }
%struct.jx = type { i32 }
@.str = [6 x i8] c"cores\00"
@.str.1 = [7 x i8] c"memory\00"
@.str.2 = [5 x i8] c"disk\00"
define %struct.ds_resources* @ds_resources_create_from_jx(%struct.jx* %0) {
%2 = alloca %struct.jx*
store %struct.jx* %0, %struct.jx** %2
%3 = load %struct.jx*, %struct.jx** %2
%4 = call i32 @jx_lookup_integer(%struct.jx* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load %struct.jx*, %struct.jx** %2
%6 = call i32 @jx_lookup_integer(%struct.jx* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = load %struct.jx*, %struct.jx** %2
%8 = call i32 @jx_lookup_integer(%struct.jx* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%9 = call %struct.ds_resources* @ds_resources_create(i32 %4, i32 %6, i32 %8)
ret %struct.ds_resources* %9
}

LLVM IR (-O2):
%struct.ds_resources = type { i32 }
%struct.jx = type { i32 }
@.str = [6 x i8] c"cores\00"
@.str.1 = [7 x i8] c"memory\00"
@.str.2 = [5 x i8] c"disk\00"
define %struct.ds_resources* @ds_resources_create_from_jx(%struct.jx* %0) {
%2 = tail call i32 @jx_lookup_integer(%struct.jx* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @jx_lookup_integer(%struct.jx* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @jx_lookup_integer(%struct.jx* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call %struct.ds_resources* @ds_resources_create(i32 %2, i32 %3, i32 %4)
ret %struct.ds_resources* %5
}