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

/* Variables and functions */
struct object *cons(void *, struct object *, struct object *);
struct object *extend_env(void *workspace, struct object *var,
                          struct object *val, struct object *env) {
  void *workspace_ARRAY[3 + 2] = {0};
  workspace_ARRAY[3] = (void *)1;
  workspace_ARRAY[3 + 1] = workspace;
  workspace = workspace_ARRAY;
  ;
  (((struct object ***)workspace)[0] = &var);
  (((struct object ***)workspace)[1] = &val);
  (((struct object ***)workspace)[2] = &env);
  return cons(workspace, cons(workspace, var, val), env);
}


x86 assembly (clang, -O0):
<extend_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
mov    $0x1,%eax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lea    -0x10(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
lea    -0x18(%rbp),%rcx
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
lea    -0x20(%rbp),%rcx
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <cons@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
mov    -0x20(%rbp),%rdx
call   1040 <cons@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extend_env>:
push   %rbx
sub    $0x50,%rsp
mov    %rsi,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rcx,0x8(%rsp)
movq   $0x1,0x38(%rsp)
mov    %rdi,0x40(%rsp)
lea    0x18(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,0x28(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <cons@plt>
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <cons@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.object = type { i32 }
define %struct.object* @extend_env(i8* %0, %struct.object* %1, %struct.object* %2, %struct.object* %3) {
%5 = alloca i8*
%6 = alloca %struct.object*
%7 = alloca %struct.object*
%8 = alloca %struct.object*
%9 = alloca [5 x i8*]
store i8* %0, i8** %5
store %struct.object* %1, %struct.object** %6
store %struct.object* %2, %struct.object** %7
store %struct.object* %3, %struct.object** %8
%10 = bitcast [5 x i8*]* %9 to i8*
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 3
store i8* inttoptr (i64 1 to i8*), i8** %11
%12 = load i8*, i8** %5
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 4
store i8* %12, i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 0
%15 = bitcast i8** %14 to i8*
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = bitcast i8* %16 to %struct.object***
%18 = getelementptr inbounds %struct.object**, %struct.object*** %17, i64 0
store %struct.object** %6, %struct.object*** %18
%19 = load i8*, i8** %5
%20 = bitcast i8* %19 to %struct.object***
%21 = getelementptr inbounds %struct.object**, %struct.object*** %20, i64 1
store %struct.object** %7, %struct.object*** %21
%22 = load i8*, i8** %5
%23 = bitcast i8* %22 to %struct.object***
%24 = getelementptr inbounds %struct.object**, %struct.object*** %23, i64 2
store %struct.object** %8, %struct.object*** %24
%25 = load i8*, i8** %5
%26 = load i8*, i8** %5
%27 = load %struct.object*, %struct.object** %6
%28 = load %struct.object*, %struct.object** %7
%29 = call %struct.object* @cons(i8* %26, %struct.object* %27, %struct.object* %28)
%30 = load %struct.object*, %struct.object** %8
%31 = call %struct.object* @cons(i8* %25, %struct.object* %29, %struct.object* %30)
ret %struct.object* %31
}

LLVM IR (-O2):
%struct.object = type { i32 }
define %struct.object* @extend_env(i8* %0, %struct.object* %1, %struct.object* %2, %struct.object* %3) {
%5 = alloca %struct.object*
%6 = alloca %struct.object*
%7 = alloca %struct.object*
%8 = alloca [5 x i8*]
store %struct.object* %1, %struct.object** %5
store %struct.object* %2, %struct.object** %6
store %struct.object* %3, %struct.object** %7
%9 = bitcast [5 x i8*]* %8 to i8*
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 3
store i8* inttoptr (i64 1 to i8*), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 4
store i8* %0, i8** %11
%12 = bitcast [5 x i8*]* %8 to %struct.object***
store %struct.object** %5, %struct.object*** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 1
%14 = bitcast i8** %13 to %struct.object***
store %struct.object** %6, %struct.object*** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 2
%16 = bitcast i8** %15 to %struct.object***
store %struct.object** %7, %struct.object*** %16
%17 = call %struct.object* @cons(i8* %9, %struct.object* %1, %struct.object* %2)
%18 = load %struct.object*, %struct.object** %7
%19 = call %struct.object* @cons(i8* %9, %struct.object* %17, %struct.object* %18)
ret %struct.object* %19
}