#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*/ substr(char *, char *, int);
int numcmp(char *s1, char *s2) {
  double v1, v2;
  char str[100];
  substr(s1, str, 100);
  v1 = atof(str);
  substr(s2, str, 100);
  v2 = atof(str);
  if (v1 < v2)
    return -1;
  else if (v1 > v2)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<numcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x64,%edx
call   1040 <substr@plt>
lea    -0x90(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x64,%edx
call   1040 <substr@plt>
lea    -0x90(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    119f <numcmp+0x7f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c2 <numcmp+0xa2>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11bb <numcmp+0x9b>
movl   $0x1,-0x4(%rbp)
jmp    11c2 <numcmp+0xa2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numcmp>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x64,%edx
call   1040 <substr@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1040 <substr@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
xor    %ecx,%ecx
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
seta   %cl
ucomisd %xmm1,%xmm0
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @numcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
%8 = alloca [100 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%11 = call i32 @substr(i8* %9, i8* %10, i32 100)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%13 = call double @atof(i8* %12)
store double %13, double* %6
%14 = load i8*, i8** %5
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%16 = call i32 @substr(i8* %14, i8* %15, i32 100)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%18 = call double @atof(i8* %17)
store double %18, double* %7
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %2
store i32 -1, i32* %3
br label %29
23: ; preds = %2
%24 = load double, double* %6
%25 = load double, double* %7
%26 = fcmp ogt double %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 1, i32* %3
br label %29
28: ; preds = %23
store i32 0, i32* %3
br label %29
29: ; preds = %28, %27, %22
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @numcmp(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @substr(i8* %0, i8* %4, i32 100)
%6 = call double @atof(i8* %4)
%7 = call i32 @substr(i8* %1, i8* %4, i32 100)
%8 = call double @atof(i8* %4)
%9 = fcmp olt double %6, %8
%10 = fcmp ogt double %6, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}