#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 */
scalar_t__ calloc(scalar_t__, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ logm(char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, scalar_t__);
int /*<<< orphan*/ strncpy(char *, char *, scalar_t__);
void logc(char *message, char *code) {
  char *temp;
  temp = (char *)calloc(strlen(message) + strlen(code), sizeof(char));
  strncpy(temp, message, strlen(message));
  strncat(temp, code, strlen(code));
  logm(temp);
  free(temp);
}


x86 assembly (clang, -O0):
<logc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x40(%rbp),%rdi
add    %rax,%rdi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
call   1060 <strncat@plt>
mov    -0x18(%rbp),%rdi
call   1080 <logm@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1050 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
add    %rax,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1040 <strncpy@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1060 <strncat@plt>
mov    %rbx,%rdi
call   1080 <logm@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @logc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = call i64 @calloc(i64 %10, i32 1)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = load i8*, i8** %3
%16 = call i64 @strlen(i8* %15)
%17 = call i32 @strncpy(i8* %13, i8* %14, i64 %16)
%18 = load i8*, i8** %5
%19 = load i8*, i8** %4
%20 = load i8*, i8** %4
%21 = call i64 @strlen(i8* %20)
%22 = call i32 @strncat(i8* %18, i8* %19, i64 %21)
%23 = load i8*, i8** %5
%24 = call i32 @logm(i8* %23)
%25 = load i8*, i8** %5
%26 = call i32 @free(i8* %25)
ret void
}

LLVM IR (-O2):
define void @logc(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, %3
%6 = tail call i64 @calloc(i64 %5, i32 1)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%9 = tail call i32 @strncpy(i8* %7, i8* %0, i64 %8)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%11 = tail call i32 @strncat(i8* %7, i8* %1, i64 %10)
%12 = tail call i32 @logm(i8* %7)
%13 = tail call i32 @free(i8* %7)
ret void
}