#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 inlinestrpos(char *);
int /*<<< orphan*/ sprintf(char *, char *, double);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(char *);
int strpos2(char *, char *, int);
int /*<<< orphan*/ strsub(char *, char *, int, int);
void ReplaceSymbolRF(char *ret, double y_value) {
  int k, ii;
  char laux[4096], inlinecomment[4096], lxp[4096];
  k = inlinestrpos(ret);
  inlinecomment[0] = '\0';
  if (k) {
    strsub(inlinecomment, ret, k, (int)strlen(ret));
    ret[k - 1] = '\0';
  }
  ii = strpos2(ret, "_RF_", 1) + 3;
  strsub(laux, ret, ii + 1, (int)strlen(ret) - ii);
  ret[ii - 2 - 2] = '\0';
  sprintf(lxp, "%E", y_value);
  strcat(ret, lxp);
  strcat(ret, laux);
  strcat(ret, inlinecomment);
}


x86 assembly (clang, -O0):
<ReplaceSymbolRF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3050,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <inlinestrpos@plt>
mov    %eax,-0x14(%rbp)
movb   $0x0,-0x2020(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11e8 <ReplaceSymbolRF+0x88>
lea    -0x2020(%rbp),%rax
mov    %rax,-0x3038(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x3030(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3024(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x3038(%rbp),%rdi
mov    -0x3030(%rbp),%rsi
mov    -0x3024(%rbp),%edx
mov    %eax,%ecx
call   1050 <strsub@plt>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
lea    0xe0d(%rip),%rsi
mov    $0x1,%edx
call   1060 <strpos2@plt>
add    $0x3,%eax
mov    %eax,-0x18(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x3050(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x3048(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x303c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x3050(%rbp),%rdi
mov    -0x3048(%rbp),%rsi
mov    -0x303c(%rbp),%edx
mov    %eax,%ecx
sub    -0x18(%rbp),%ecx
call   1050 <strsub@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x3020(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xd8f(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x3020(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
call   1070 <strcat@plt>
add    $0x3050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReplaceSymbolRF>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x3018,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
call   1040 <inlinestrpos@plt>
movb   $0x0,0x10(%rsp)
test   %eax,%eax
je     11a7 <ReplaceSymbolRF+0x47>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1050 <strsub@plt>
movslq %ebp,%rax
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1060 <strpos2@plt>
mov    %eax,%ebp
lea    0x4(%rbp),%r14d
mov    %rbx,%rdi
call   1030 <strlen@plt>
sub    %ebp,%eax
lea    -0x3(%rax),%ecx
lea    0x2010(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <strsub@plt>
movslq %ebp,%rax
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xe12(%rip),%rsi
lea    0x1010(%rsp),%rbp
mov    %rbp,%rdi
movsd  0x8(%rsp),%xmm0
call   1080 <sprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
add    $0x3018,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"_RF_\00"
@.str.1 = [3 x i8] c"%E\00"
define void @ReplaceSymbolRF(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4096 x i8]
%8 = alloca [4096 x i8]
%9 = alloca [4096 x i8]
store i8* %0, i8** %3
store double %1, double* %4
%10 = load i8*, i8** %3
%11 = call i32 @inlinestrpos(i8* %10)
store i32 %11, i32* %5
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
store i8 0, i8* %12
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %2
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%19 = load i8*, i8** %3
%20 = call i64 @strlen(i8* %19)
%21 = trunc i64 %20 to i32
%22 = call i32 @strsub(i8* %16, i8* %17, i32 %18, i32 %21)
%23 = load i8*, i8** %3
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
store i8 0, i8* %27
br label %28
28: ; preds = %15, %2
%29 = load i8*, i8** %3
%30 = call i32 @strpos2(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%31 = add nsw i32 %30, 3
store i32 %31, i32* %6
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%33 = load i8*, i8** %3
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
%36 = load i8*, i8** %3
%37 = call i64 @strlen(i8* %36)
%38 = trunc i64 %37 to i32
%39 = load i32, i32* %6
%40 = sub nsw i32 %38, %39
%41 = call i32 @strsub(i8* %32, i8* %33, i32 %35, i32 %40)
%42 = load i8*, i8** %3
%43 = load i32, i32* %6
%44 = sub nsw i32 %43, 2
%45 = sub nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %42, i64 %46
store i8 0, i8* %47
%48 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%49 = load double, double* %4
%50 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %49)
%51 = load i8*, i8** %3
%52 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%53 = call i32 @strcat(i8* %51, i8* %52)
%54 = load i8*, i8** %3
%55 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%56 = call i32 @strcat(i8* %54, i8* %55)
%57 = load i8*, i8** %3
%58 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%59 = call i32 @strcat(i8* %57, i8* %58)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"_RF_\00"
@.str.1 = [3 x i8] c"%E\00"
define void @ReplaceSymbolRF(i8* %0, double %1) {
%3 = alloca [4096 x i8]
%4 = alloca [4096 x i8]
%5 = alloca [4096 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%9 = tail call i32 @inlinestrpos(i8* %0)
store i8 0, i8* %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%13 = trunc i64 %12 to i32
%14 = call i32 @strsub(i8* %7, i8* %0, i32 %9, i32 %13)
%15 = add nsw i32 %9, -1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %11, %2
%19 = call i32 @strpos2(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%20 = add nsw i32 %19, 4
%21 = call i64 @strlen(i8* dereferenceable(1) %0)
%22 = trunc i64 %21 to i32
%23 = sub i32 -3, %19
%24 = add i32 %23, %22
%25 = call i32 @strsub(i8* %6, i8* %0, i32 %20, i32 %24)
%26 = add nsw i32 %19, -1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %0, i64 %27
store i8 0, i8* %28
%29 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %1)
%30 = call i32 @strcat(i8* %0, i8* %8)
%31 = call i32 @strcat(i8* %0, i8* %6)
%32 = call i32 @strcat(i8* %0, i8* %7)
ret void
}