#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int sscanf(char *, char *, double *, char *);
int /*<<< orphan*/ stderr;
int pl_Double(void *variable, int argc, char *argv[], int i, int k) {
  char c = '\0';
  if (i >= argc) {
    fprintf(stderr, "The command line is missing a floating ");
    fprintf(stderr, "point number at its end.\n\n");
    return (0);
  } else if ((sscanf(&argv[i][k], "%lf%c", (double *)variable, &c) != 1) ||
             (c != '\0')) {
    fprintf(stderr, "\"%s\" (from item %d on the command line) ", &argv[i][k],
            i);
    fprintf(stderr, "is not a floating point number.\n\n");
    return (0);
  } else
    return (i + 1);
}


x86 assembly (clang, -O0):
<pl_Double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
movb   $0x0,-0x29(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1184 <pl_Double+0x64>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121a <pl_Double+0xfa>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x28(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
lea    0xea1(%rip),%rsi
lea    -0x29(%rbp),%rcx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11c1 <pl_Double+0xa1>
movsbl -0x29(%rbp),%eax
cmp    $0x0,%eax
je     1211 <pl_Double+0xf1>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x28(%rbp),%rax
add    %rax,%rdx
mov    -0x24(%rbp),%ecx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121a <pl_Double+0xfa>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_Double>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xf(%rsp)
cmp    %esi,%ecx
jge    116f <pl_Double+0x4f>
mov    %ecx,%ebx
mov    %rdx,%rbp
mov    %rdi,%rdx
movslq %ecx,%r15
movslq %r8d,%r14
mov    0x0(%rbp,%r15,8),%rdi
add    %r14,%rdi
lea    0xef1(%rip),%rsi
lea    0xf(%rsp),%rcx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1193 <pl_Double+0x73>
cmpb   $0x0,0xf(%rsp)
jne    1193 <pl_Double+0x73>
add    $0x1,%ebx
mov    %ebx,%ebp
jmp    11ca <pl_Double+0xaa>
mov    0x2e6a(%rip),%rbx
mov    (%rbx),%edi
lea    0xe81(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe97(%rip),%rsi
jmp    11c3 <pl_Double+0xa3>
mov    0x2e46(%rip),%r12
mov    (%r12),%edi
add    0x0(%rbp,%r15,8),%r14
lea    0xe9f(%rip),%rsi
xor    %ebp,%ebp
mov    %r14,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
lea    0xeaf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"The command line is missing a floating \00"
@.str.1 = [27 x i8] c"point number at its end.\0A\0A\00"
@.str.2 = [6 x i8] c"%lf%c\00"
@.str.3 = [41 x i8] c"\22%s\22 (from item %d on the command line) \00"
@.str.4 = [34 x i8] c"is not a floating point number.\0A\0A\00"
define i32 @pl_Double(i8* %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8 0, i8* %12
%13 = load i32, i32* %10
%14 = load i32, i32* %8
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %5
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %55
21: ; preds = %5
%22 = load i8**, i8*** %9
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8*, i8** %7
%31 = bitcast i8* %30 to double*
%32 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double* %31, i8* %12)
%33 = icmp ne i32 %32, 1
br i1 %33, label %38, label %34
34: ; preds = %21
%35 = load i8, i8* %12
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %52
38: ; preds = %34, %21
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %9
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i32, i32* %10
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %47, i32 %48)
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %6
br label %55
52: ; preds = %34
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %55
55: ; preds = %52, %38, %16
%56 = load i32, i32* %6
ret i32 %56
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"The command line is missing a floating \00"
@.str.1 = [27 x i8] c"point number at its end.\0A\0A\00"
@.str.2 = [6 x i8] c"%lf%c\00"
@.str.3 = [41 x i8] c"\22%s\22 (from item %d on the command line) \00"
@.str.4 = [34 x i8] c"is not a floating point number.\0A\0A\00"
define i32 @pl_Double(i8* %0, i32 %1, i8** nocapture %2, i32 %3, i32 %4) {
%6 = alloca i8
store i8 0, i8* %6
%7 = icmp slt i32 %3, %1
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %34
13: ; preds = %5
%14 = sext i32 %3 to i64
%15 = getelementptr inbounds i8*, i8** %2, i64 %14
%16 = load i8*, i8** %15
%17 = sext i32 %4 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
%19 = bitcast i8* %0 to double*
%20 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double* %19, i8* %6)
%21 = icmp ne i32 %20, 1
%22 = load i8, i8* %6
%23 = icmp ne i8 %22, 0
%24 = select i1 %21, i1 true, i1 %23
br i1 %24, label %25, label %32
25: ; preds = %13
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %15
%28 = getelementptr inbounds i8, i8* %27, i64 %17
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %28, i32 %3)
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %34
32: ; preds = %13
%33 = add nsw i32 %3, 1
br label %34
34: ; preds = %32, %25, %8
%35 = phi i32 [ 0, %8 ], [ 0, %25 ], [ %33, %32 ]
ret i32 %35
}