#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 */
double atof(char *);
int /*<<< orphan*/ character_exists(char *, char);
int /*<<< orphan*/ piece(char *, char, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, double);
int /*<<< orphan*/ strcpy(char *, char *);
char *get_new_value(char *buffer, char delimiter, int piece_offset) {
  char value_string[128];
  double value_double;
  static char new_value[128];
  static int line_number = 0;
  line_number++;
  if (!piece(value_string, delimiter, buffer, piece_offset)) {
    return (char *)0;
  }
  if (!character_exists(value_string, 'e') &&
      (!character_exists(value_string, '-') ||
       !character_exists(value_string, '+'))) {
    strcpy(new_value, value_string);
    return new_value;
  }
  value_double = atof(value_string);
  sprintf(new_value, "%.8lf", value_double);
  return new_value;
}


x86 assembly (clang, -O0):
<get_new_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
mov    0x2f72(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f69(%rip)
lea    -0xa0(%rbp),%rdi
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%ecx
movsbl %al,%esi
call   1070 <piece@plt>
cmp    $0x0,%eax
jne    11a6 <get_new_value+0x56>
movq   $0x0,-0x8(%rbp)
jmp    1251 <get_new_value+0x101>
lea    -0xa0(%rbp),%rdi
mov    $0x65,%esi
call   1050 <character_exists@plt>
cmp    $0x0,%eax
jne    1217 <get_new_value+0xc7>
lea    -0xa0(%rbp),%rdi
mov    $0x2d,%esi
call   1050 <character_exists@plt>
cmp    $0x0,%eax
je     11f4 <get_new_value+0xa4>
lea    -0xa0(%rbp),%rdi
mov    $0x2b,%esi
call   1050 <character_exists@plt>
cmp    $0x0,%eax
jne    1217 <get_new_value+0xc7>
lea    -0xa0(%rbp),%rsi
lea    0x2e5e(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2e52(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1251 <get_new_value+0x101>
lea    -0xa0(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
lea    0x2e26(%rip),%rdi
lea    0xdbf(%rip),%rsi
call   1060 <sprintf@plt>
lea    0x2e13(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_new_value>:
push   %rbx
sub    $0x80,%rsp
mov    %edx,%ecx
mov    %rdi,%rdx
addl   $0x1,0x2f7c(%rip)
mov    %rsp,%rdi
call   1070 <piece@plt>
test   %eax,%eax
je     11a1 <get_new_value+0x51>
mov    %rsp,%rdi
mov    $0x65,%esi
call   1050 <character_exists@plt>
test   %eax,%eax
je     11a5 <get_new_value+0x55>
mov    %rsp,%rdi
call   1040 <atof@plt>
lea    0x2ed0(%rip),%rbx
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
call   1060 <sprintf@plt>
jmp    11d9 <get_new_value+0x89>
xor    %ebx,%ebx
jmp    11d9 <get_new_value+0x89>
mov    %rsp,%rdi
mov    $0x2d,%esi
call   1050 <character_exists@plt>
test   %eax,%eax
je     11c7 <get_new_value+0x77>
mov    %rsp,%rdi
mov    $0x2b,%esi
call   1050 <character_exists@plt>
test   %eax,%eax
jne    1181 <get_new_value+0x31>
lea    0x2e92(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@get_new_value.new_value = internal global [128 x i8] zeroinitializer
@get_new_value.line_number = internal global i32 0
@.str = [6 x i8] c"%.8lf\00"
define i8* @get_new_value(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i32
%8 = alloca [128 x i8]
%9 = alloca double
store i8* %0, i8** %5
store i8 %1, i8* %6
store i32 %2, i32* %7
%10 = load i32, i32* @get_new_value.line_number
%11 = add nsw i32 %10, 1
store i32 %11, i32* @get_new_value.line_number
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%13 = load i8, i8* %6
%14 = load i8*, i8** %5
%15 = load i32, i32* %7
%16 = call i32 @piece(i8* %12, i8 signext %13, i8* %14, i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %3
store i8* null, i8** %4
br label %39
19: ; preds = %3
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%21 = call i32 @character_exists(i8* %20, i8 signext 101)
%22 = icmp ne i32 %21, 0
br i1 %22, label %34, label %23
23: ; preds = %19
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%25 = call i32 @character_exists(i8* %24, i8 signext 45)
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%29 = call i32 @character_exists(i8* %28, i8 signext 43)
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %27, %23
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%33 = call i32 @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), i8* %32)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), i8** %4
br label %39
34: ; preds = %27, %19
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%36 = call double @atof(i8* %35)
store double %36, double* %9
%37 = load double, double* %9
%38 = call i32 @sprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %37)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), i8** %4
br label %39
39: ; preds = %34, %31, %18
%40 = load i8*, i8** %4
ret i8* %40
}

LLVM IR (-O2):
@get_new_value.new_value = internal global [128 x i8] zeroinitializer
@get_new_value.line_number = internal unnamed_addr global i32 0
@.str = [6 x i8] c"%.8lf\00"
define i8* @get_new_value(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* @get_new_value.line_number
%7 = add nsw i32 %6, 1
store i32 %7, i32* @get_new_value.line_number
%8 = call i32 @piece(i8* %5, i8 signext %1, i8* %0, i32 %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %3
%11 = call i32 @character_exists(i8* %5, i8 signext 101)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = call i32 @character_exists(i8* %5, i8 signext 45)
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = call i32 @character_exists(i8* %5, i8 signext 43)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16, %13
%20 = call i32 @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), i8* %5)
br label %24
21: ; preds = %16, %10
%22 = call double @atof(i8* %5)
%23 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %22)
br label %24
24: ; preds = %3, %21, %19
%25 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), %21 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @get_new_value.new_value, i64 0, i64 0), %19 ], [ null, %3 ]
ret i8* %25
}