#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*/ free(char *);
char *l_getParam(char **);
int s_len(char *);
double strtod(char *, char **);
char *l_getParamDig(char **ptr, double *dig) {
  char *mem = (*ptr) + 2;
  char *tmp = l_getParam(ptr);
  char *buf;
  if (tmp == NULL)
    return NULL;
  if (s_len(tmp) > 64 - 2) {
    free(tmp);
    return NULL;
  }
  *dig = strtod(tmp, &buf);
  if ((*buf) != '\0') {
    *ptr = mem;
    free(tmp);
    return NULL;
  }
  return tmp;
}


x86 assembly (clang, -O0):
<l_getParamDig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <l_getParam@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1184 <l_getParamDig+0x44>
movq   $0x0,-0x8(%rbp)
jmp    11fa <l_getParamDig+0xba>
mov    -0x28(%rbp),%rdi
call   1050 <s_len@plt>
cmp    $0x3e,%eax
jle    11ac <l_getParamDig+0x6c>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    11fa <l_getParamDig+0xba>
mov    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strtod@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11f2 <l_getParamDig+0xb2>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    11fa <l_getParamDig+0xba>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_getParamDig>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    (%rdi),%r12
call   1060 <l_getParam@plt>
test   %rax,%rax
je     1193 <l_getParamDig+0x53>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <s_len@plt>
cmp    $0x3e,%eax
jg     118b <l_getParamDig+0x4b>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <strtod@plt>
movsd  %xmm0,(%r15)
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     1195 <l_getParamDig+0x55>
add    $0x2,%r12
mov    %r12,(%r14)
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @l_getParamDig(i8** %0, double* %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca double*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8** %0, i8*** %4
store double* %1, double** %5
%9 = load i8**, i8*** %4
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i64 2
store i8* %11, i8** %6
%12 = load i8**, i8*** %4
%13 = call i8* @l_getParam(i8** %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %2
store i8* null, i8** %3
br label %39
17: ; preds = %2
%18 = load i8*, i8** %7
%19 = call i32 @s_len(i8* %18)
%20 = icmp sgt i32 %19, 62
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i8*, i8** %7
%23 = call i32 @free(i8* %22)
store i8* null, i8** %3
br label %39
24: ; preds = %17
%25 = load i8*, i8** %7
%26 = call double @strtod(i8* %25, i8** %8)
%27 = load double*, double** %5
store double %26, double* %27
%28 = load i8*, i8** %8
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %24
%33 = load i8*, i8** %6
%34 = load i8**, i8*** %4
store i8* %33, i8** %34
%35 = load i8*, i8** %7
%36 = call i32 @free(i8* %35)
store i8* null, i8** %3
br label %39
37: ; preds = %24
%38 = load i8*, i8** %7
store i8* %38, i8** %3
br label %39
39: ; preds = %37, %32, %21, %16
%40 = load i8*, i8** %3
ret i8* %40
}

LLVM IR (-O2):
define i8* @l_getParamDig(i8** %0, double* nocapture writeonly %1) {
%3 = alloca i8*
%4 = load i8*, i8** %0
%5 = getelementptr inbounds i8, i8* %4, i64 2
%6 = tail call i8* @l_getParam(i8** %0)
%7 = bitcast i8** %3 to i8*
%8 = icmp eq i8* %6, null
br i1 %8, label %20, label %9
9: ; preds = %2
%10 = tail call i32 @s_len(i8* %6)
%11 = icmp sgt i32 %10, 62
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = call double @strtod(i8* %6, i8** %3)
store double %13, double* %1
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %12
store i8* %5, i8** %0
br label %18
18: ; preds = %9, %17
%19 = tail call i32 @free(i8* %6)
br label %20
20: ; preds = %18, %12, %2
%21 = phi i8* [ null, %2 ], [ %6, %12 ], [ null, %18 ]
ret i8* %21
}