#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 session {
  int dummy;
};
struct listnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_internal_variable(struct session *, char *);
char *get_arg_in_braces(char *, char *, int /*<<< orphan*/);
char *get_list_item(struct session *, struct listnode *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
struct session *array_get(struct session *ses, struct listnode *list,
                          char *arg) {
  char left[10000], right[10000], buf[10000];
  arg = get_arg_in_braces(arg, left, 0);
  arg = get_arg_in_braces(arg, right, 0);
  sprintf(buf, "{%s} {%s}", right, get_list_item(ses, list, left));
  do_internal_variable(ses, buf);
  return ses;
}


x86 assembly (clang, -O0):
<array_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7560,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x2730(%rbp),%rsi
xor    %edx,%edx
call   1030 <get_arg_in_braces@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x4e40(%rbp),%rsi
xor    %edx,%edx
call   1030 <get_arg_in_braces@plt>
mov    %rax,-0x18(%rbp)
lea    -0x7550(%rbp),%rax
mov    %rax,-0x7560(%rbp)
lea    -0x4e40(%rbp),%rax
mov    %rax,-0x7558(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x2730(%rbp),%rdx
call   1040 <get_list_item@plt>
mov    -0x7560(%rbp),%rdi
mov    -0x7558(%rbp),%rdx
mov    %rax,%rcx
lea    0xe35(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x7550(%rbp),%rsi
call   1060 <do_internal_variable@plt>
mov    -0x8(%rbp),%rax
add    $0x7560,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_get>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7538,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x4e20(%rsp),%r15
mov    %rdx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <get_arg_in_braces@plt>
lea    0x2710(%rsp),%r12
mov    %rax,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <get_arg_in_braces@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <get_list_item@plt>
lea    0xe6d(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r12,%rdx
mov    %rax,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <do_internal_variable@plt>
mov    %rbx,%rax
add    $0x7538,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.session = type { i32 }
%struct.listnode = type { i32 }
@.str = [10 x i8] c"{%s} {%s}\00"
define %struct.session* @array_get(%struct.session* %0, %struct.listnode* %1, i8* %2) {
%4 = alloca %struct.session*
%5 = alloca %struct.listnode*
%6 = alloca i8*
%7 = alloca [10000 x i8]
%8 = alloca [10000 x i8]
%9 = alloca [10000 x i8]
store %struct.session* %0, %struct.session** %4
store %struct.listnode* %1, %struct.listnode** %5
store i8* %2, i8** %6
%10 = load i8*, i8** %6
%11 = getelementptr inbounds [10000 x i8], [10000 x i8]* %7, i64 0, i64 0
%12 = call i8* @get_arg_in_braces(i8* %10, i8* %11, i32 0)
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%15 = call i8* @get_arg_in_braces(i8* %13, i8* %14, i32 0)
store i8* %15, i8** %6
%16 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%17 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%18 = load %struct.session*, %struct.session** %4
%19 = load %struct.listnode*, %struct.listnode** %5
%20 = getelementptr inbounds [10000 x i8], [10000 x i8]* %7, i64 0, i64 0
%21 = call i8* @get_list_item(%struct.session* %18, %struct.listnode* %19, i8* %20)
%22 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %21)
%23 = load %struct.session*, %struct.session** %4
%24 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%25 = call i32 @do_internal_variable(%struct.session* %23, i8* %24)
%26 = load %struct.session*, %struct.session** %4
ret %struct.session* %26
}

LLVM IR (-O2):
%struct.session = type { i32 }
%struct.listnode = type { i32 }
@.str = [10 x i8] c"{%s} {%s}\00"
define %struct.session* @array_get(%struct.session* returned %0, %struct.listnode* %1, i8* %2) {
%4 = alloca [10000 x i8]
%5 = alloca [10000 x i8]
%6 = alloca [10000 x i8]
%7 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%10 = call i8* @get_arg_in_braces(i8* %2, i8* %7, i32 0)
%11 = call i8* @get_arg_in_braces(i8* %10, i8* %8, i32 0)
%12 = call i8* @get_list_item(%struct.session* %0, %struct.listnode* %1, i8* %7)
%13 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %12)
%14 = call i32 @do_internal_variable(%struct.session* %0, i8* %9)
ret %struct.session* %0
}