#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 DoVprintf(char const *, double);
int /*<<< orphan*/ Fail(char *, int, int, int);
int strlen(char const *);
void DoDoubleTest(const char *formatstr, double param, const char *checkstr1,
                  const char *checkstr2) {
  int ret;
  ret = DoVprintf(formatstr, param);
  if (ret != strlen(checkstr1) && ret != strlen(checkstr2)) {
    Fail("Expected vprintf to return %d or %d, got %d.\n", strlen(checkstr1),
         strlen(checkstr2), ret);
  }
}


x86 assembly (clang, -O0):
<DoDoubleTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
call   1040 <DoVprintf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
je     11bb <DoDoubleTest+0x8b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
je     11bb <DoDoubleTest+0x8b>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%esi
mov    %eax,%edx
mov    -0x24(%rbp),%ecx
lea    0xe4a(%rip),%rdi
call   1050 <Fail@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoDoubleTest>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
call   1040 <DoVprintf@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
je     1159 <DoDoubleTest+0x29>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jne    115e <DoDoubleTest+0x2e>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0xe89(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
mov    %ebp,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <Fail@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Expected vprintf to return %d or %d, got %d.\0A\00"
define void @DoDoubleTest(i8* %0, double %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca double
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store double %1, double* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load double, double* %6
%12 = call i32 @DoVprintf(i8* %10, double %11)
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = load i8*, i8** %7
%15 = call i32 @strlen(i8* %14)
%16 = icmp ne i32 %13, %15
br i1 %16, label %17, label %29
17: ; preds = %4
%18 = load i32, i32* %9
%19 = load i8*, i8** %8
%20 = call i32 @strlen(i8* %19)
%21 = icmp ne i32 %18, %20
br i1 %21, label %22, label %29
22: ; preds = %17
%23 = load i8*, i8** %7
%24 = call i32 @strlen(i8* %23)
%25 = load i8*, i8** %8
%26 = call i32 @strlen(i8* %25)
%27 = load i32, i32* %9
%28 = call i32 @Fail(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %26, i32 %27)
br label %29
29: ; preds = %22, %17, %4
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"Expected vprintf to return %d or %d, got %d.\0A\00"
define void @DoDoubleTest(i8* %0, double %1, i8* %2, i8* %3) {
%5 = tail call i32 @DoVprintf(i8* %0, double %1)
%6 = tail call i32 @strlen(i8* %2)
%7 = icmp eq i32 %5, %6
br i1 %7, label %15, label %8
8: ; preds = %4
%9 = tail call i32 @strlen(i8* %3)
%10 = icmp eq i32 %5, %9
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @strlen(i8* %2)
%13 = tail call i32 @strlen(i8* %3)
%14 = tail call i32 @Fail(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %5)
br label %15
15: ; preds = %11, %8, %4
ret void
}