#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 */
char *opt_get_string(char const *, char const *, int /*<<< orphan*/ *);
int sscanf(char const *, char *, double *, double *, double *, double *);
int opt_get_double4(const char *section, const char *key, double *p1,
                    double *p2, double *p3, double *p4) {
  const char *value;
  value = opt_get_string(section, key, NULL);
  if (!value)
    return -1;
  if (sscanf(value, " ( %lf , %lf , %lf , %lf) ", p1, p2, p3, p4) < 4)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<opt_get_double4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <opt_get_string@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    116c <opt_get_double4+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a8 <opt_get_double4+0x88>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
lea    0xe79(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x4,%eax
jge    11a1 <opt_get_double4+0x81>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a8 <opt_get_double4+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_get_double4>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
xor    %edx,%edx
call   1040 <opt_get_string@plt>
test   %rax,%rax
je     1169 <opt_get_double4+0x49>
lea    0xeb9(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
setl   %al
neg    %eax
jmp    116e <opt_get_double4+0x4e>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c" ( %lf , %lf , %lf , %lf) \00"
define i32 @opt_get_double4(i8* %0, i8* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i8*
store i8* %0, i8** %8
store i8* %1, i8** %9
store double* %2, double** %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = call i8* @opt_get_string(i8* %15, i8* %16, i32* null)
store i8* %17, i8** %14
%18 = load i8*, i8** %14
%19 = icmp ne i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %6
store i32 -1, i32* %7
br label %31
21: ; preds = %6
%22 = load i8*, i8** %14
%23 = load double*, double** %10
%24 = load double*, double** %11
%25 = load double*, double** %12
%26 = load double*, double** %13
%27 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double* %23, double* %24, double* %25, double* %26)
%28 = icmp slt i32 %27, 4
br i1 %28, label %29, label %30
29: ; preds = %21
store i32 -1, i32* %7
br label %31
30: ; preds = %21
store i32 0, i32* %7
br label %31
31: ; preds = %30, %29, %20
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
@.str = [27 x i8] c" ( %lf , %lf , %lf , %lf) \00"
define i32 @opt_get_double4(i8* %0, i8* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = tail call i8* @opt_get_string(i8* %0, i8* %1, i32* null)
%8 = icmp eq i8* %7, null
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double* %2, double* %3, double* %4, double* %5)
%11 = icmp slt i32 %10, 4
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %9, %6
%14 = phi i32 [ -1, %6 ], [ %12, %9 ]
ret i32 %14
}