#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 *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, scalar_t__);
void logn(char *message, int nr) {
  char *temp;
  char str_nr[13];
  temp = (char *)calloc((strlen(message) + 13), sizeof(char));
  strncpy(temp, message, strlen(message));
  snprintf(str_nr, 13, " : %i", nr);
  strncat(temp, str_nr, 13);
  logm(temp);
  free(temp);
}


x86 assembly (clang, -O0):
<logn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0xd,%rdi
mov    $0x1,%esi
call   1080 <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>
lea    -0x25(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0xd,%esi
lea    0xe27(%rip),%rdx
call   1060 <snprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x25(%rbp),%rsi
mov    $0xd,%edx
call   1070 <strncat@plt>
mov    -0x18(%rbp),%rdi
call   1090 <logm@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logn>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbp
call   1050 <strlen@plt>
lea    0xd(%rax),%rdi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1040 <strncpy@plt>
lea    0xe4f(%rip),%rdx
lea    0x3(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xd,%esi
mov    %r14d,%ecx
call   1060 <snprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0xd,%edx
call   1070 <strncat@plt>
mov    %rbx,%rdi
call   1090 <logm@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c" : %i\00"
define void @logn(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [13 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = add nsw i64 %8, 13
%10 = call i64 @calloc(i64 %9, i32 1)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = load i8*, i8** %3
%14 = load i8*, i8** %3
%15 = call i64 @strlen(i8* %14)
%16 = call i32 @strncpy(i8* %12, i8* %13, i64 %15)
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%18 = load i32, i32* %4
%19 = call i32 @snprintf(i8* %17, i32 13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %5
%21 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%22 = call i32 @strncat(i8* %20, i8* %21, i32 13)
%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):
@.str = [6 x i8] c" : %i\00"
define void @logn(i8* %0, i32 %1) {
%3 = alloca [13 x i8]
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add nsw i64 %5, 13
%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 = call i32 @snprintf(i8* %4, i32 13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
%12 = call i32 @strncat(i8* %8, i8* %4, i32 13)
%13 = call i32 @logm(i8* %8)
%14 = call i32 @free(i8* %8)
ret void
}