#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 const *, int, char const *,
                        char const *, char *);
int /*<<< orphan*/ _countof(char *);
scalar_t__ memcmp(char *, char const *, scalar_t__);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ testvsp(char *, int /*<<< orphan*/, char const *, int,
                           double);
void DoArgumentPrecDoubleTest(const char *formatstr, int precision,
                              double param, const char *checkstr1,
                              const char *checkstr2) {
  char buf[256];
  testvsp(buf, _countof(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    $0x160,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x148(%rbp)
lea    -0x130(%rbp),%rdi
call   1060 <_countof@plt>
mov    -0x148(%rbp),%rdi
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
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     1256 <DoArgumentPrecDoubleTest+0x106>
lea    -0x130(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x158(%rbp),%rdi
mov    -0x150(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1256 <DoArgumentPrecDoubleTest+0x106>
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    0xdaf(%rip),%rdi
call   1070 <Fail@plt>
add    $0x160,%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
movsd  %xmm0,0x8(%rsp)
mov    %esi,%r15d
mov    %rdi,%r12
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <_countof@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
movsd  0x8(%rsp),%xmm0
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     11f1 <DoArgumentPrecDoubleTest+0xa1>
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     11f1 <DoArgumentPrecDoubleTest+0xa1>
lea    0xe2b(%rip),%rdi
lea    0x10(%rsp),%r9
movsd  0x8(%rsp),%xmm0
mov    %r12,%rsi
mov    %r15d,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1070 <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 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%14 = call i32 @_countof(i8* %13)
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = load double, double* %8
%18 = call i32 @testvsp(i8* %12, i32 %14, i8* %15, i32 %16, double %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%20 = load i8*, i8** %9
%21 = load i8*, i8** %9
%22 = call i64 @strlen(i8* %21)
%23 = add nsw i64 %22, 1
%24 = call i64 @memcmp(i8* %19, i8* %20, i64 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %42
26: ; preds = %5
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%28 = load i8*, i8** %10
%29 = load i8*, i8** %10
%30 = call i64 @strlen(i8* %29)
%31 = add nsw i64 %30, 1
%32 = call i64 @memcmp(i8* %27, i8* %28, i64 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %26
%35 = load double, double* %8
%36 = load i8*, i8** %6
%37 = load i32, i32* %7
%38 = load i8*, i8** %9
%39 = load i8*, i8** %10
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%41 = call i32 @Fail(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), double %35, i8* %36, i32 %37, i8* %38, i8* %39, i8* %40)
br label %42
42: ; preds = %34, %26, %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 @_countof(i8* %7)
%9 = call i32 @testvsp(i8* %7, i32 %8, i8* %0, i32 %1, double %2)
%10 = call i64 @strlen(i8* dereferenceable(1) %3)
%11 = add nsw i64 %10, 1
%12 = call i64 @memcmp(i8* %7, i8* %3, i64 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %5
%15 = call i64 @strlen(i8* dereferenceable(1) %4)
%16 = add nsw i64 %15, 1
%17 = call i64 @memcmp(i8* %7, i8* %4, i64 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %14
%20 = 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 %21
21: ; preds = %19, %14, %5
ret void
}