#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 */

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ load_file_scm(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int strlen(char *);
void include_scm(char *fileName) {
  char *ex = ".scm";
  int len = strlen(fileName) + strlen(ex);
  char *f = (char *)malloc(sizeof(char) * len);
  sprintf(f, "%s%s", fileName, ex);
  load_file_scm(f);
  free(f);
}


x86 assembly (clang, -O0):
<include_scm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe59(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <load_file_scm@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<include_scm>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0xe9b(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %eax,%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
lea    0xe85(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1070 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <load_file_scm@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [5 x i8] c".scm\00"
@.str.1 = [5 x i8] c"%s%s\00"
define void @include_scm(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = add nsw i32 %7, %9
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = mul i64 1, %12
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = load i8*, i8** %2
%19 = load i8*, i8** %3
%20 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %18, i8* %19)
%21 = load i8*, i8** %5
%22 = call i32 @load_file_scm(i8* %21)
%23 = load i8*, i8** %5
%24 = call i32 @free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".scm\00"
@.str.1 = [5 x i8] c"%s%s\00"
define void @include_scm(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = add nsw i32 %3, %2
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @load_file_scm(i8* %6)
%9 = tail call i32 @free(i8* %6)
ret void
}