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


x86 assembly (clang, -O0):
<DoArgumentPrecDoubleTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
call   1040 <printf@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
je     11c1 <DoArgumentPrecDoubleTest+0x91>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
je     11c1 <DoArgumentPrecDoubleTest+0x91>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%esi
mov    %eax,%edx
mov    -0x2c(%rbp),%ecx
lea    0xe44(%rip),%rdi
call   1050 <Fail@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoArgumentPrecDoubleTest>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
call   1040 <printf@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
je     1159 <DoArgumentPrecDoubleTest+0x29>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jne    115e <DoArgumentPrecDoubleTest+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 = [45 x i8] c"Expected printf to return %d or %d, got %d.\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 i32
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 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load double, double* %8
%15 = call i32 @printf(i8* %12, i32 %13, double %14)
store i32 %15, i32* %11
%16 = load i32, i32* %11
%17 = load i8*, i8** %9
%18 = call i32 @strlen(i8* %17)
%19 = icmp ne i32 %16, %18
br i1 %19, label %20, label %32
20: ; preds = %5
%21 = load i32, i32* %11
%22 = load i8*, i8** %10
%23 = call i32 @strlen(i8* %22)
%24 = icmp ne i32 %21, %23
br i1 %24, label %25, label %32
25: ; preds = %20
%26 = load i8*, i8** %9
%27 = call i32 @strlen(i8* %26)
%28 = load i8*, i8** %10
%29 = call i32 @strlen(i8* %28)
%30 = load i32, i32* %11
%31 = call i32 @Fail(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %29, i32 %30)
br label %32
32: ; preds = %25, %20, %5
ret void
}

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