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


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

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

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

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