#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 /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
float strtod(char *, char **);
float readFloat(char *cmdResult) {
  int kk;
  char *jj;
  float zz;
  char ss[140];
  jj = strstr(cmdResult, "Float:");
  strcpy(ss, (jj + 7));
  kk = strlen(ss);
  if (kk > 2)
    zz = strtod(ss, &jj);
  return (zz);
}


x86 assembly (clang, -O0):
<readFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x7,%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jle    11a5 <readFloat+0x65>
lea    -0xb0(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <strtod@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFloat>:
push   %rbx
sub    $0xa0,%rsp
lea    0xeb1(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,0x8(%rsp)
lea    0x7(%rax),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jl     1186 <readFloat+0x46>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <strtod@plt>
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Float:\00"
define float @readFloat(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca float
%6 = alloca [140 x i8]
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @strstr(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %4
%9 = getelementptr inbounds [140 x i8], [140 x i8]* %6, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 7
%12 = call i32 @strcpy(i8* %9, i8* %11)
%13 = getelementptr inbounds [140 x i8], [140 x i8]* %6, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = getelementptr inbounds [140 x i8], [140 x i8]* %6, i64 0, i64 0
%19 = call float @strtod(i8* %18, i8** %4)
store float %19, float* %5
br label %20
20: ; preds = %17, %1
%21 = load float, float* %5
ret float %21
}

LLVM IR (-O2):
@.str = [7 x i8] c"Float:\00"
define float @readFloat(i8* %0) {
%2 = alloca i8*
%3 = alloca [140 x i8]
%4 = bitcast i8** %2 to i8*
%5 = getelementptr inbounds [140 x i8], [140 x i8]* %3, i64 0, i64 0
%6 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 7
%8 = call i32 @strcpy(i8* %5, i8* %7)
%9 = call i32 @strlen(i8* %5)
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call float @strtod(i8* %5, i8** %2)
br label %13
13: ; preds = %11, %1
%14 = phi float [ %12, %11 ], [ undef, %1 ]
ret float %14
}