#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 *, char *, 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,
                           void *);
void DoArgumentPrecTest(const char *formatstr, int precision, void *param,
                        char *paramstr, 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 %s into \"%s\" with precision %d\n"
         "Expected \"%s\" or \"%s\", got \"%s\".\n",
         paramstr, formatstr, precision, checkstr1, checkstr2, buf);
  }
}


x86 assembly (clang, -O0):
<DoArgumentPrecTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%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
mov    -0x18(%rbp),%r8
call   1030 <testvsp@plt>
lea    -0x130(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x28(%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     125b <DoArgumentPrecTest+0x10b>
lea    -0x130(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x30(%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     125b <DoArgumentPrecTest+0x10b>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    -0x130(%rbp),%rax
lea    0xdae(%rip),%rdi
mov    %rax,(%rsp)
call   1070 <Fail@plt>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoArgumentPrecTest>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,%r14
mov    %r8,%r13
mov    %rcx,0x8(%rsp)
mov    %rdx,%rbp
mov    %esi,%r12d
mov    %rdi,%r15
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <_countof@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r15,%rdx
mov    %r12d,%ecx
mov    %rbp,%r8
call   1030 <testvsp@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <memcmp@plt>
test   %rax,%rax
je     11f3 <DoArgumentPrecTest+0xa3>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <memcmp@plt>
test   %rax,%rax
je     11f3 <DoArgumentPrecTest+0xa3>
mov    %rbx,(%rsp)
lea    0xe23(%rip),%rdi
mov    0x8(%rsp),%rsi
mov    %r15,%rdx
mov    %r12d,%ecx
mov    %r13,%r8
mov    %r14,%r9
call   1070 <Fail@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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