#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 kid {
  int dummy;
};
struct animal_builder {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ animal_builder_build_arm(struct animal_builder *);
int /*<<< orphan*/ animal_builder_build_body(struct animal_builder *);
int /*<<< orphan*/ animal_builder_build_header(struct animal_builder *);
int /*<<< orphan*/ animal_builder_build_leg(struct animal_builder *);
int /*<<< orphan*/ animal_builder_build_tail(struct animal_builder *);
int /*<<< orphan*/ printf(char *);
void kid_make_animal(struct kid *kid, struct animal_builder *builder) {
  printf("kid::make_animal()\n");
  animal_builder_build_header(builder);
  animal_builder_build_body(builder);
  animal_builder_build_leg(builder);
  animal_builder_build_arm(builder);
  animal_builder_build_tail(builder);
}


x86 assembly (clang, -O0):
<kid_make_animal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe89(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <animal_builder_build_header@plt>
mov    -0x10(%rbp),%rdi
call   1080 <animal_builder_build_body@plt>
mov    -0x10(%rbp),%rdi
call   1070 <animal_builder_build_leg@plt>
mov    -0x10(%rbp),%rdi
call   1050 <animal_builder_build_arm@plt>
mov    -0x10(%rbp),%rdi
call   1030 <animal_builder_build_tail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kid_make_animal>:
push   %rbx
mov    %rsi,%rbx
lea    0xe95(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1040 <animal_builder_build_header@plt>
mov    %rbx,%rdi
call   1080 <animal_builder_build_body@plt>
mov    %rbx,%rdi
call   1070 <animal_builder_build_leg@plt>
mov    %rbx,%rdi
call   1060 <animal_builder_build_arm@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <animal_builder_build_tail@plt>

LLVM IR (-O0):
%struct.kid = type { i32 }
%struct.animal_builder = type { i32 }
@.str = [20 x i8] c"kid::make_animal()\0A\00"
define void @kid_make_animal(%struct.kid* %0, %struct.animal_builder* %1) {
%3 = alloca %struct.kid*
%4 = alloca %struct.animal_builder*
store %struct.kid* %0, %struct.kid** %3
store %struct.animal_builder* %1, %struct.animal_builder** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = load %struct.animal_builder*, %struct.animal_builder** %4
%7 = call i32 @animal_builder_build_header(%struct.animal_builder* %6)
%8 = load %struct.animal_builder*, %struct.animal_builder** %4
%9 = call i32 @animal_builder_build_body(%struct.animal_builder* %8)
%10 = load %struct.animal_builder*, %struct.animal_builder** %4
%11 = call i32 @animal_builder_build_leg(%struct.animal_builder* %10)
%12 = load %struct.animal_builder*, %struct.animal_builder** %4
%13 = call i32 @animal_builder_build_arm(%struct.animal_builder* %12)
%14 = load %struct.animal_builder*, %struct.animal_builder** %4
%15 = call i32 @animal_builder_build_tail(%struct.animal_builder* %14)
ret void
}

LLVM IR (-O2):
%struct.kid = type { i32 }
%struct.animal_builder = type { i32 }
@str = [19 x i8] c"kid::make_animal()\00"
define void @kid_make_animal(%struct.kid* nocapture readnone %0, %struct.animal_builder* %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @animal_builder_build_header(%struct.animal_builder* %1)
%5 = tail call i32 @animal_builder_build_body(%struct.animal_builder* %1)
%6 = tail call i32 @animal_builder_build_leg(%struct.animal_builder* %1)
%7 = tail call i32 @animal_builder_build_arm(%struct.animal_builder* %1)
%8 = tail call i32 @animal_builder_build_tail(%struct.animal_builder* %1)
ret void
}