#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*/ assert(int);
char *malloc(int);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *make_file_path(char *fold_path, char *field_name, char *suffix) {
  int fold_path_len = strlen(fold_path);
  int fld_name_len = strlen(field_name);
  int suffix_len = strlen(suffix);
  char *result = malloc(fold_path_len + fld_name_len + suffix_len + 1);
  strncpy(result, fold_path, fold_path_len + 1);
  assert(result[fold_path_len] == '\0');
  strncat(result, field_name, fld_name_len + 1);
  assert(result[fld_name_len + fold_path_len] == '\0');
  strncat(result, suffix, suffix_len + 1);
  assert(result[fld_name_len + fold_path_len + suffix_len] == '\0');
  return result;
}


x86 assembly (clang, -O0):
<make_file_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
add    -0x20(%rbp),%edi
add    -0x24(%rbp),%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
call   1050 <strncat@plt>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
add    $0x1,%edx
call   1050 <strncat@plt>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_file_path>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rdx,0x10(%rsp)
mov    %rsi,%rbp
mov    %rsi,0x8(%rsp)
mov    %rdi,(%rsp)
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    (%r14,%r13,1),%r12d
lea    (%r12,%r15,1),%ebp
lea    (%r15,%r12,1),%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0x1(%r14),%edx
mov    %rbx,%rdi
mov    (%rsp),%rsi
call   1030 <strncpy@plt>
movslq %r14d,%rax
xor    %edi,%edi
cmpb   $0x0,(%rbx,%rax,1)
sete   %dil
call   1060 <assert@plt>
add    $0x1,%r13d
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    %r13d,%edx
call   1050 <strncat@plt>
movslq %r12d,%rax
xor    %edi,%edi
cmpb   $0x0,(%rbx,%rax,1)
sete   %dil
call   1060 <assert@plt>
add    $0x1,%r15d
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
mov    %r15d,%edx
call   1050 <strncat@plt>
movslq %ebp,%rax
xor    %edi,%edi
cmpb   $0x0,(%rbx,%rax,1)
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @make_file_path(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %7
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %8
%15 = load i8*, i8** %6
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %9
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %9
%21 = add nsw i32 %19, %20
%22 = add nsw i32 %21, 1
%23 = call i8* @malloc(i32 %22)
store i8* %23, i8** %10
%24 = load i8*, i8** %10
%25 = load i8*, i8** %4
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
%28 = call i32 @strncpy(i8* %24, i8* %25, i32 %27)
%29 = load i8*, i8** %10
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 0
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load i8*, i8** %10
%39 = load i8*, i8** %5
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
%42 = call i32 @strncat(i8* %38, i8* %39, i32 %41)
%43 = load i8*, i8** %10
%44 = load i32, i32* %8
%45 = load i32, i32* %7
%46 = add nsw i32 %44, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %43, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 0
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = load i8*, i8** %10
%55 = load i8*, i8** %6
%56 = load i32, i32* %9
%57 = add nsw i32 %56, 1
%58 = call i32 @strncat(i8* %54, i8* %55, i32 %57)
%59 = load i8*, i8** %10
%60 = load i32, i32* %8
%61 = load i32, i32* %7
%62 = add nsw i32 %60, %61
%63 = load i32, i32* %9
%64 = add nsw i32 %62, %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %59, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 0
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = load i8*, i8** %10
ret i8* %72
}

LLVM IR (-O2):
define i8* @make_file_path(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @strlen(i8* %2)
%7 = add nsw i32 %5, %4
%8 = add nsw i32 %7, %6
%9 = add nsw i32 %8, 1
%10 = tail call i8* @malloc(i32 %9)
%11 = add nsw i32 %4, 1
%12 = tail call i32 @strncpy(i8* %10, i8* %0, i32 %11)
%13 = sext i32 %4 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = add nsw i32 %5, 1
%20 = tail call i32 @strncat(i8* %10, i8* %1, i32 %19)
%21 = sext i32 %7 to i64
%22 = getelementptr inbounds i8, i8* %10, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = add nsw i32 %6, 1
%28 = tail call i32 @strncat(i8* %10, i8* %2, i32 %27)
%29 = sext i32 %8 to i64
%30 = getelementptr inbounds i8, i8* %10, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 0
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
ret i8* %10
}