#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 atoi(char *);
double fabs(double);
int /*<<< orphan*/ glp_lib_fault(char *, double);
int /*<<< orphan*/ glp_lib_insist(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
char *strchr(char *, char);
char *strcpy(char *, char *);
int strlen(char *);
char *mps_numb(double val, char numb[12 + 1]) {
  int n;
  char str[255 + 1], *e;
  for (n = 12; n >= 6; n--) {
    if (val != 0.0 && fabs(val) < 0.002)
      sprintf(str, "%.*E", n - 1, val);
    else
      sprintf(str, "%.*G", n, val);
    ((void)((strlen(str) <= 255) ||
            (glp_lib_insist(
                 "strlen(str) <= 255",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/"
                 "master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplpx8a.c",
                 350),
             1)));
    e = strchr(str, 'E');
    if (e != NULL)
      sprintf(e + 1, "%d", atoi(e + 1));
    if (strlen(str) <= 12)
      return strcpy(numb, str);
  }
  glp_lib_fault("lpx_write_mps: can't convert floating point number '%g' to"
                " character string",
                val);
  return NULL;
}


x86 assembly (clang, -O0):
<mps_numb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movl   $0xc,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jl     12fe <mps_numb+0x18e>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b2 <mps_numb+0x42>
jp     11b2 <mps_numb+0x42>
jmp    11f9 <mps_numb+0x89>
movsd  -0x10(%rbp),%xmm1
movaps 0xe52(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe36(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f9 <mps_numb+0x89>
lea    -0x120(%rbp),%rdi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
movsd  -0x10(%rbp),%xmm0
lea    0xe33(%rip),%rsi
mov    $0x1,%al
call   1090 <sprintf@plt>
jmp    1216 <mps_numb+0xa6>
lea    -0x120(%rbp),%rdi
mov    -0x1c(%rbp),%edx
movsd  -0x10(%rbp),%xmm0
lea    0xe16(%rip),%rsi
mov    $0x1,%al
call   1090 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0xff,%ecx
mov    %al,-0x129(%rbp)
jle    1258 <mps_numb+0xe8>
lea    0xdeb(%rip),%rdi
lea    0xdf7(%rip),%rsi
mov    $0x15e,%edx
call   1070 <glp_lib_insist@plt>
mov    $0x1,%al
mov    %al,-0x129(%rbp)
mov    -0x129(%rbp),%al
lea    -0x120(%rbp),%rdi
mov    $0x45,%esi
call   1050 <strchr@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     12bd <mps_numb+0x14d>
mov    -0x128(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x138(%rbp)
mov    -0x128(%rbp),%rdi
add    $0x1,%rdi
call   1080 <atoi@plt>
mov    -0x138(%rbp),%rdi
mov    %eax,%edx
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0xc,%eax
jg     12eb <mps_numb+0x17b>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x8(%rbp)
jmp    1317 <mps_numb+0x1a7>
jmp    12f0 <mps_numb+0x180>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <mps_numb+0x1b>
movsd  -0x10(%rbp),%xmm0
lea    0xddf(%rip),%rdi
call   1060 <glp_lib_fault@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mps_numb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %rdi,0x18(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setp   %al
setne  %cl
or     %al,%cl
movapd 0xe62(%rip),%xmm2
movapd %xmm0,(%rsp)
andpd  %xmm0,%xmm2
movsd  0xe61(%rip),%xmm1
ucomisd %xmm2,%xmm1
seta   %bpl
and    %cl,%bpl
mov    $0xd,%edx
lea    0x20(%rsp),%rbx
lea    0xf13(%rip),%r12
lea    0xe4b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rdx),%r15d
test   %bpl,%bpl
je     1200 <mps_numb+0x90>
add    $0xfffffffe,%edx
mov    %rbx,%rdi
lea    0xe22(%rip),%rsi
jmp    1209 <mps_numb+0x99>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
movapd (%rsp),%xmm0
mov    $0x1,%al
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x100,%eax
jl     123c <mps_numb+0xcc>
lea    0xdf7(%rip),%rdi
lea    0xe03(%rip),%rsi
mov    $0x15e,%edx
call   1070 <glp_lib_insist@plt>
mov    %rbx,%rdi
mov    $0x45,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     126c <mps_numb+0xfc>
mov    %rax,%r13
add    $0x1,%r13
mov    %r13,%rdi
call   1080 <atoi@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xc,%eax
jle    129b <mps_numb+0x12b>
mov    %r15d,%edx
cmp    $0x7,%r15d
jae    11e0 <mps_numb+0x70>
lea    0xe54(%rip),%rdi
movapd (%rsp),%xmm0
call   1060 <glp_lib_fault@plt>
xor    %ebx,%ebx
jmp    12ad <mps_numb+0x13d>
lea    0x20(%rsp),%rsi
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.*E\00"
@.str.1 = [5 x i8] c"%.*G\00"
@.str.2 = [19 x i8] c"strlen(str) <= 255\00"
@.str.3 = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplpx8a.c\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [76 x i8] c"lpx_write_mps: can't convert floating point number '%g' to character string\00"
define i8* @mps_numb(double %0, i8* %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i8*
store double %0, double* %4
store i8* %1, i8** %5
store i32 12, i32* %6
br label %9
9: ; preds = %59, %2
%10 = load i32, i32* %6
%11 = icmp sge i32 %10, 6
br i1 %11, label %12, label %62
12: ; preds = %9
%13 = load double, double* %4
%14 = fcmp une double %13, 0.000000e+00
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load double, double* %4
%17 = call double @llvm.fabs.f64(double %16)
%18 = fcmp olt double %17, 2.000000e-03
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = load double, double* %4
%24 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %22, double %23)
br label %30
25: ; preds = %15, %12
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%27 = load i32, i32* %6
%28 = load double, double* %4
%29 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %27, double %28)
br label %30
30: ; preds = %25, %19
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%32 = call i32 @strlen(i8* %31)
%33 = icmp sle i32 %32, 255
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = call i32 @glp_lib_insist(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.3, i64 0, i64 0), i32 350)
br label %36
36: ; preds = %34, %30
%37 = phi i1 [ true, %30 ], [ true, %34 ]
%38 = zext i1 %37 to i32
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%40 = call i8* @strchr(i8* %39, i8 signext 69)
store i8* %40, i8** %8
%41 = load i8*, i8** %8
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %50
43: ; preds = %36
%44 = load i8*, i8** %8
%45 = getelementptr inbounds i8, i8* %44, i64 1
%46 = load i8*, i8** %8
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = call i32 @atoi(i8* %47)
%49 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %43, %36
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
%53 = icmp sle i32 %52, 12
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i8*, i8** %5
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%57 = call i8* @strcpy(i8* %55, i8* %56)
store i8* %57, i8** %3
br label %65
58: ; preds = %50
br label %59
59: ; preds = %58
%60 = load i32, i32* %6
%61 = add nsw i32 %60, -1
store i32 %61, i32* %6
br label %9
62: ; preds = %9
%63 = load double, double* %4
%64 = call i32 @glp_lib_fault(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.5, i64 0, i64 0), double %63)
store i8* null, i8** %3
br label %65
65: ; preds = %62, %54
%66 = load i8*, i8** %3
ret i8* %66
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.*E\00"
@.str.1 = [5 x i8] c"%.*G\00"
@.str.2 = [19 x i8] c"strlen(str) <= 255\00"
@.str.3 = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplpx8a.c\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [76 x i8] c"lpx_write_mps: can't convert floating point number '%g' to character string\00"
define i8* @mps_numb(double %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = fcmp une double %0, 0.000000e+00
%6 = call double @llvm.fabs.f64(double %0)
%7 = fcmp olt double %6, 2.000000e-03
%8 = select i1 %5, i1 %7, i1 false
br label %12
9: ; preds = %31
%10 = add nsw i32 %13, -1
%11 = icmp ugt i32 %13, 6
br i1 %11, label %12, label %36
12: ; preds = %2, %9
%13 = phi i32 [ 12, %2 ], [ %10, %9 ]
br i1 %8, label %14, label %17
14: ; preds = %12
%15 = add nsw i32 %13, -1
%16 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15, double %0)
br label %19
17: ; preds = %12
%18 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13, double %0)
br label %19
19: ; preds = %17, %14
%20 = call i32 @strlen(i8* %4)
%21 = icmp slt i32 %20, 256
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = call i32 @glp_lib_insist(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.3, i64 0, i64 0), i32 350)
br label %24
24: ; preds = %22, %19
%25 = call i8* @strchr(i8* %4, i8 signext 69)
%26 = icmp eq i8* %25, null
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = getelementptr inbounds i8, i8* %25, i64 1
%29 = call i32 @atoi(i8* %28)
%30 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %28, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %27, %24
%32 = call i32 @strlen(i8* %4)
%33 = icmp slt i32 %32, 13
br i1 %33, label %34, label %9
34: ; preds = %31
%35 = call i8* @strcpy(i8* dereferenceable(1) %1, i8* %4)
br label %38
36: ; preds = %9
%37 = call i32 @glp_lib_fault(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.5, i64 0, i64 0), double %0)
br label %38
38: ; preds = %36, %34
%39 = phi i8* [ %1, %34 ], [ null, %36 ]
ret i8* %39
}