#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 *lr_eval_string(char *);
int /*<<< orphan*/ lr_output_message(char *, char *);
int /*<<< orphan*/ lr_save_string(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
ConvertIntegerToParameter() {
  char String[500];
  int integerVariable = 23456789;
  sprintf(String, "%d", integerVariable);
  lr_output_message("New string is [%s]", String);
  lr_save_string(String, "ParamFromString");
  lr_output_message("New parameter is [%s]",
                    lr_eval_string("{ParamFromString}"));
  return 0;
}


x86 assembly (clang, -O0):
<ConvertIntegerToParameter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x165ec15,-0x204(%rbp)
ec 65 01
lea    -0x200(%rbp),%rdi
mov    -0x204(%rbp),%edx
lea    0xe97(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x200(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <lr_output_message@plt>
lea    -0x200(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1050 <lr_save_string@plt>
lea    0xea1(%rip),%rdi
call   1030 <lr_eval_string@plt>
mov    %rax,%rsi
lea    0xe7c(%rip),%rdi
call   1040 <lr_output_message@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertIntegerToParameter>:
push   %rbx
sub    $0x200,%rsp
lea    0xeb1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x165ec15,%edx
call   1060 <sprintf@plt>
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
call   1040 <lr_output_message@plt>
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
call   1050 <lr_save_string@plt>
lea    0xeb8(%rip),%rdi
call   1030 <lr_eval_string@plt>
lea    0xe96(%rip),%rdi
mov    %rax,%rsi
call   1040 <lr_output_message@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [19 x i8] c"New string is [%s]\00"
@.str.2 = [16 x i8] c"ParamFromString\00"
@.str.3 = [22 x i8] c"New parameter is [%s]\00"
@.str.4 = [18 x i8] c"{ParamFromString}\00"
define i32 @ConvertIntegerToParameter() {
%1 = alloca [500 x i8]
%2 = alloca i32
store i32 23456789, i32* %2
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* %2
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%7 = call i32 @lr_output_message(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%9 = call i32 @lr_save_string(i8* %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%10 = call i8* @lr_eval_string(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @lr_output_message(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [19 x i8] c"New string is [%s]\00"
@.str.2 = [16 x i8] c"ParamFromString\00"
@.str.3 = [22 x i8] c"New parameter is [%s]\00"
@.str.4 = [18 x i8] c"{ParamFromString}\00"
define i32 @ConvertIntegerToParameter() {
%1 = alloca [500 x i8]
%2 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 23456789)
%4 = call i32 @lr_output_message(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @lr_save_string(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%6 = call i8* @lr_eval_string(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @lr_output_message(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %6)
ret i32 0
}