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


x86 assembly (clang, -O0):
<opt_get_double2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <opt_get_string@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1164 <opt_get_double2+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <opt_get_double2+0x78>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe89(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x2,%eax
jge    1191 <opt_get_double2+0x71>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <opt_get_double2+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_get_double2>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
xor    %edx,%edx
call   1040 <opt_get_string@plt>
test   %rax,%rax
je     1159 <opt_get_double2+0x39>
lea    0xec3(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
setl   %al
neg    %eax
jmp    115e <opt_get_double2+0x3e>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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