#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 */
int /*<<< orphan*/ json_object_array_add(struct json_object *,
                                         int /*<<< orphan*/);
struct json_object *json_object_new_array();
int /*<<< orphan*/ json_object_new_string(char *);
int /*<<< orphan*/ json_object_object_add(struct json_object *, char *,
                                          struct json_object *);
void jsonrpc_system_list_methods(struct json_object *request,
                                 struct json_object *response) {
  struct json_object *methods = json_object_new_array();
  json_object_array_add(methods,
                        json_object_new_string("contoller.getDevices"));
  json_object_array_add(methods,
                        json_object_new_string("contoller.getDeviceInfo"));
  json_object_array_add(methods,
                        json_object_new_string("contoller.setDeviceInfo"));
  json_object_array_add(methods, json_object_new_string("contoller.setDevice"));
  json_object_array_add(methods, json_object_new_string("contoller.getEvents"));
  json_object_object_add(response, "result", methods);
}


x86 assembly (clang, -O0):
<jsonrpc_system_list_methods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <json_object_new_array@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    0xe96(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xe8c(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe85(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe7e(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe73(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe68(%rip),%rsi
call   1060 <json_object_object_add@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsonrpc_system_list_methods>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
xor    %eax,%eax
call   1030 <json_object_new_array@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
lea    0xea7(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
lea    0xea9(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
lea    0xeab(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
lea    0xea9(%rip),%rdi
call   1040 <json_object_new_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <json_object_array_add@plt>
lea    0xea7(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <json_object_object_add@plt>

LLVM IR (-O0):
%struct.json_object = type { i32 }
@.str = [21 x i8] c"contoller.getDevices\00"
@.str.1 = [24 x i8] c"contoller.getDeviceInfo\00"
@.str.2 = [24 x i8] c"contoller.setDeviceInfo\00"
@.str.3 = [20 x i8] c"contoller.setDevice\00"
@.str.4 = [20 x i8] c"contoller.getEvents\00"
@.str.5 = [7 x i8] c"result\00"
define void @jsonrpc_system_list_methods(%struct.json_object* %0, %struct.json_object* %1) {
%3 = alloca %struct.json_object*
%4 = alloca %struct.json_object*
%5 = alloca %struct.json_object*
store %struct.json_object* %0, %struct.json_object** %3
store %struct.json_object* %1, %struct.json_object** %4
%6 = call %struct.json_object* (...) @json_object_new_array()
store %struct.json_object* %6, %struct.json_object** %5
%7 = load %struct.json_object*, %struct.json_object** %5
%8 = call i32 @json_object_new_string(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @json_object_array_add(%struct.json_object* %7, i32 %8)
%10 = load %struct.json_object*, %struct.json_object** %5
%11 = call i32 @json_object_new_string(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @json_object_array_add(%struct.json_object* %10, i32 %11)
%13 = load %struct.json_object*, %struct.json_object** %5
%14 = call i32 @json_object_new_string(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @json_object_array_add(%struct.json_object* %13, i32 %14)
%16 = load %struct.json_object*, %struct.json_object** %5
%17 = call i32 @json_object_new_string(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @json_object_array_add(%struct.json_object* %16, i32 %17)
%19 = load %struct.json_object*, %struct.json_object** %5
%20 = call i32 @json_object_new_string(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @json_object_array_add(%struct.json_object* %19, i32 %20)
%22 = load %struct.json_object*, %struct.json_object** %4
%23 = load %struct.json_object*, %struct.json_object** %5
%24 = call i32 @json_object_object_add(%struct.json_object* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), %struct.json_object* %23)
ret void
}

LLVM IR (-O2):
%struct.json_object = type { i32 }
@.str = [21 x i8] c"contoller.getDevices\00"
@.str.1 = [24 x i8] c"contoller.getDeviceInfo\00"
@.str.2 = [24 x i8] c"contoller.setDeviceInfo\00"
@.str.3 = [20 x i8] c"contoller.setDevice\00"
@.str.4 = [20 x i8] c"contoller.getEvents\00"
@.str.5 = [7 x i8] c"result\00"
define void @jsonrpc_system_list_methods(%struct.json_object* nocapture readnone %0, %struct.json_object* %1) {
%3 = tail call %struct.json_object* (...) @json_object_new_array()
%4 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @json_object_array_add(%struct.json_object* %3, i32 %4)
%6 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @json_object_array_add(%struct.json_object* %3, i32 %6)
%8 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @json_object_array_add(%struct.json_object* %3, i32 %8)
%10 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @json_object_array_add(%struct.json_object* %3, i32 %10)
%12 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i32 @json_object_array_add(%struct.json_object* %3, i32 %12)
%14 = tail call i32 @json_object_object_add(%struct.json_object* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), %struct.json_object* %3)
ret void
}