#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*/ Fail(char *, double, char *, int, char *, char *, char *);
scalar_t__ memcmp(char *, char *, scalar_t__);
scalar_t__ strlen(char *);
int /*<<< orphan*/ testvsp(char *, char *, int, double);
void DoArgumentPrecDoubleTest(char *formatstr, int precision, double param,
                              char *checkstr1, char *checkstr2) {
  char buf[256];
  testvsp(buf, formatstr, precision, param);
  if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
      memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) {
    Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n"
         "Expected \"%s\" or \"%s\", got \"%s\".\n",
         param, formatstr, precision, checkstr1, checkstr2, buf);
  }
}


x86 assembly (clang, -O0):
<DoArgumentPrecDoubleTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
movsd  -0x18(%rbp),%xmm0
call   1030 <testvsp@plt>
lea    -0x130(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x140(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     122a <DoArgumentPrecDoubleTest+0xea>
lea    -0x130(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x150(%rbp),%rdi
mov    -0x148(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     122a <DoArgumentPrecDoubleTest+0xea>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x130(%rbp),%r9
lea    0xddb(%rip),%rdi
call   1060 <Fail@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoArgumentPrecDoubleTest>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%r12
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r15d,%edx
movsd  %xmm0,0x8(%rsp)
call   1030 <testvsp@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <memcmp@plt>
test   %rax,%rax
je     11d1 <DoArgumentPrecDoubleTest+0x91>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
call   1050 <memcmp@plt>
test   %rax,%rax
je     11d1 <DoArgumentPrecDoubleTest+0x91>
lea    0xe4b(%rip),%rdi
lea    0x10(%rsp),%r9
movsd  0x8(%rsp),%xmm0
mov    %r12,%rsi
mov    %r15d,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1060 <Fail@plt>
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [89 x i8] c"ERROR: failed to insert %f into \22%s\22 with precision %d\0AExpected \22%s\22 or \22%s\22, got \22%s\22.\0A\00"
define void @DoArgumentPrecDoubleTest(i8* %0, i32 %1, double %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca double
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store double %2, double* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = load double, double* %8
%16 = call i32 @testvsp(i8* %12, i8* %13, i32 %14, double %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%18 = load i8*, i8** %9
%19 = load i8*, i8** %9
%20 = call i64 @strlen(i8* %19)
%21 = add nsw i64 %20, 1
%22 = call i64 @memcmp(i8* %17, i8* %18, i64 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %40
24: ; preds = %5
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%26 = load i8*, i8** %10
%27 = load i8*, i8** %10
%28 = call i64 @strlen(i8* %27)
%29 = add nsw i64 %28, 1
%30 = call i64 @memcmp(i8* %25, i8* %26, i64 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %24
%33 = load double, double* %8
%34 = load i8*, i8** %6
%35 = load i32, i32* %7
%36 = load i8*, i8** %9
%37 = load i8*, i8** %10
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%39 = call i32 @Fail(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), double %33, i8* %34, i32 %35, i8* %36, i8* %37, i8* %38)
br label %40
40: ; preds = %32, %24, %5
ret void
}

LLVM IR (-O2):
@.str = [89 x i8] c"ERROR: failed to insert %f into \22%s\22 with precision %d\0AExpected \22%s\22 or \22%s\22, got \22%s\22.\0A\00"
define void @DoArgumentPrecDoubleTest(i8* %0, i32 %1, double %2, i8* %3, i8* %4) {
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = call i32 @testvsp(i8* %7, i8* %0, i32 %1, double %2)
%9 = call i64 @strlen(i8* dereferenceable(1) %3)
%10 = add nsw i64 %9, 1
%11 = call i64 @memcmp(i8* %7, i8* %3, i64 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %5
%14 = call i64 @strlen(i8* dereferenceable(1) %4)
%15 = add nsw i64 %14, 1
%16 = call i64 @memcmp(i8* %7, i8* %4, i64 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = call i32 @Fail(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), double %2, i8* %0, i32 %1, i8* %3, i8* %4, i8* %7)
br label %20
20: ; preds = %18, %13, %5
ret void
}