#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*/ dotToSlash(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ nextFile(char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char const *);
int /*<<< orphan*/ strncat(char *, char const *, int);
void importFile(const char *fileName) {
  char *javaFileName;
  int fileNameLen;
  fileNameLen = strlen(fileName);
  javaFileName = (char *)malloc(fileNameLen + 6);
  javaFileName[0] = 0;
  strncat(javaFileName, fileName, fileNameLen - 1);
  dotToSlash(javaFileName);
  strcat(javaFileName, ".java");
  nextFile(javaFileName);
  free(javaFileName);
}


x86 assembly (clang, -O0):
<importFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x6,%edi
call   1080 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1060 <strncat@plt>
mov    -0x10(%rbp),%rdi
call   1040 <dotToSlash@plt>
mov    -0x10(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1070 <nextFile@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<importFile>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%r15d
lea    0x6(%r15),%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0xffffffff,%r15d
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1060 <strncat@plt>
mov    %rbx,%rdi
call   1040 <dotToSlash@plt>
lea    0xe50(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1070 <nextFile@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c".java\00"
define void @importFile(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 6
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
store i8 0, i8* %5
%6 = add nsw i32 %2, -1
%7 = tail call i32 @strncat(i8* %5, i8* %0, i32 %6)
%8 = tail call i32 @dotToSlash(i8* %5)
%9 = tail call i32 @strcat(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @nextFile(i8* %5)
%11 = tail call i32 @free(i8* %5)
ret void
}