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


x86 assembly (clang, -O0):
<opt_get_int3>:
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    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <opt_get_string@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1168 <opt_get_int3+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <opt_get_int3+0x80>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
lea    0xe81(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jge    1199 <opt_get_int3+0x79>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <opt_get_int3+0x80>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_get_int3>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
xor    %edx,%edx
call   1040 <opt_get_string@plt>
test   %rax,%rax
je     1160 <opt_get_int3+0x40>
lea    0xebf(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
setl   %al
neg    %eax
jmp    1165 <opt_get_int3+0x45>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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