#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;
};
struct cons {
  int dummy;
};
struct atom {
  int dummy;
};

/* Variables and functions */
struct cons *create_cons(void *, struct object *);
int /*<<< orphan*/ set_root_g(struct object **, void *);
void map_cons(struct atom *key, struct object *value, struct object **map) {
  struct cons *entry = create_cons((void *)key, value);
  struct cons *cons = create_cons((void *)entry, *map);
  set_root_g(map, (void *)cons);
}


x86 assembly (clang, -O0):
<map_cons>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <create_cons@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1040 <create_cons@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <set_root_g@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_cons>:
push   %rbx
mov    %rdx,%rbx
call   1040 <create_cons@plt>
mov    (%rbx),%rsi
mov    %rax,%rdi
call   1040 <create_cons@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <set_root_g@plt>

LLVM IR (-O0):
%struct.atom = type { i32 }
%struct.object = type { i32 }
%struct.cons = type { i32 }
define void @map_cons(%struct.atom* %0, %struct.object* %1, %struct.object** %2) {
%4 = alloca %struct.atom*
%5 = alloca %struct.object*
%6 = alloca %struct.object**
%7 = alloca %struct.cons*
%8 = alloca %struct.cons*
store %struct.atom* %0, %struct.atom** %4
store %struct.object* %1, %struct.object** %5
store %struct.object** %2, %struct.object*** %6
%9 = load %struct.atom*, %struct.atom** %4
%10 = bitcast %struct.atom* %9 to i8*
%11 = load %struct.object*, %struct.object** %5
%12 = call %struct.cons* @create_cons(i8* %10, %struct.object* %11)
store %struct.cons* %12, %struct.cons** %7
%13 = load %struct.cons*, %struct.cons** %7
%14 = bitcast %struct.cons* %13 to i8*
%15 = load %struct.object**, %struct.object*** %6
%16 = load %struct.object*, %struct.object** %15
%17 = call %struct.cons* @create_cons(i8* %14, %struct.object* %16)
store %struct.cons* %17, %struct.cons** %8
%18 = load %struct.object**, %struct.object*** %6
%19 = load %struct.cons*, %struct.cons** %8
%20 = bitcast %struct.cons* %19 to i8*
%21 = call i32 @set_root_g(%struct.object** %18, i8* %20)
ret void
}

LLVM IR (-O2):
%struct.atom = type { i32 }
%struct.object = type { i32 }
%struct.cons = type { i32 }
define void @map_cons(%struct.atom* %0, %struct.object* %1, %struct.object** %2) {
%4 = bitcast %struct.atom* %0 to i8*
%5 = tail call %struct.cons* @create_cons(i8* %4, %struct.object* %1)
%6 = bitcast %struct.cons* %5 to i8*
%7 = load %struct.object*, %struct.object** %2
%8 = tail call %struct.cons* @create_cons(i8* %6, %struct.object* %7)
%9 = bitcast %struct.cons* %8 to i8*
%10 = tail call i32 @set_root_g(%struct.object** %2, i8* %9)
ret void
}