#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 */
char *calloc(scalar_t__, int);
int /*<<< orphan*/ sprintf(char *, char *, char const *, int, char const *,
                           char const *, char const *);
scalar_t__ strlen(char const *);
char *assemble_message2(const char *msg1, const char *msg2, const char *srcfile,
                        const char *funname, int line) {
  char *msgbuffer = calloc(strlen(msg1) + strlen(msg2) + strlen(srcfile) +
                               strlen(funname) + 10 + 10,
                           sizeof(char));
  sprintf(msgbuffer, "%s:%d - %s() - %s %s", srcfile, line, funname, msg1,
          msg2);
  return msgbuffer;
}


x86 assembly (clang, -O0):
<assemble_message2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
add    %rax,%rdi
add    $0xa,%rdi
add    $0xa,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x8(%rbp),%r9
mov    -0x10(%rbp),%rax
lea    0xe35(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <sprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble_message2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0xc(%rsp)
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,0x10(%rsp)
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %rbx,%r14
add    %r15,%r14
lea    (%rax,%r14,1),%rdi
add    $0x14,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %rbp,(%rsp)
lea    0xe63(%rip),%rsi
mov    %rax,%rdi
mov    %r13,%rdx
mov    0xc(%rsp),%ecx
mov    %r12,%r8
mov    0x10(%rsp),%r9
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"%s:%d - %s() - %s %s\00"
define i8* @assemble_message2(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i8*, i8** %6
%13 = call i64 @strlen(i8* %12)
%14 = load i8*, i8** %7
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %13, %15
%17 = load i8*, i8** %8
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 %16, %18
%20 = load i8*, i8** %9
%21 = call i64 @strlen(i8* %20)
%22 = add nsw i64 %19, %21
%23 = add nsw i64 %22, 10
%24 = add nsw i64 %23, 10
%25 = call i8* @calloc(i64 %24, i32 1)
store i8* %25, i8** %11
%26 = load i8*, i8** %11
%27 = load i8*, i8** %8
%28 = load i32, i32* %10
%29 = load i8*, i8** %9
%30 = load i8*, i8** %6
%31 = load i8*, i8** %7
%32 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %27, i32 %28, i8* %29, i8* %30, i8* %31)
%33 = load i8*, i8** %11
ret i8* %33
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s:%d - %s() - %s %s\00"
define i8* @assemble_message2(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%10 = add i64 %6, 20
%11 = add i64 %10, %7
%12 = add i64 %11, %8
%13 = add i64 %12, %9
%14 = tail call i8* @calloc(i64 %13, i32 1)
%15 = tail call i32 @sprintf(i8* dereferenceable(1) %14, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %4, i8* %3, i8* %0, i8* %1)
ret i8* %14
}