#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*/ free(char *);
char *malloc_or_die(scalar_t__);
int /*<<< orphan*/ print_name_and_dvalue(char *, double);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strlen(char *);
void print_name2_and_dvalue(char *a, char *b, double value) {
  char *name = malloc_or_die(strlen(a) + strlen(b) + 2);
  sprintf(name, "%s_%s", a, b);
  print_name_and_dvalue(name, value);
  free(name);
}


x86 assembly (clang, -O0):
<print_name2_and_dvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1060 <malloc_or_die@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe5e(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x20(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1050 <print_name_and_dvalue@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_name2_and_dvalue>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x2,%rdi
call   1060 <malloc_or_die@plt>
mov    %rax,%rbx
lea    0xe76(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
call   1050 <print_name_and_dvalue@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s_%s\00"
define void @print_name2_and_dvalue(i8* %0, i8* %1, double %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store double %2, double* %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 = add nsw i64 %12, 2
%14 = call i8* @malloc_or_die(i64 %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %7
%20 = load double, double* %6
%21 = call i32 @print_name_and_dvalue(i8* %19, double %20)
%22 = load i8*, i8** %7
%23 = call i32 @free(i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s_%s\00"
define void @print_name2_and_dvalue(i8* %0, i8* %1, double %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = add i64 %4, 2
%7 = add i64 %6, %5
%8 = tail call i8* @malloc_or_die(i64 %7)
%9 = tail call i32 @sprintf(i8* dereferenceable(1) %8, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%10 = tail call i32 @print_name_and_dvalue(i8* %8, double %2)
%11 = tail call i32 @free(i8* %8)
ret void
}