#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*/ print_csi_sgr(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reset_attributes();
void print_fail(const char *test_name, const char *position) {
  printf("\n");
  print_csi_sgr(95);
  printf("%s\n", position);
  reset_attributes();
  print_csi_sgr(31);
  print_csi_sgr(1);
  printf("%s failed", test_name);
  printf(": ");
  reset_attributes();
}


x86 assembly (clang, -O0):
<print_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x5f,%edi
call   1030 <print_csi_sgr@plt>
mov    -0x10(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <reset_attributes@plt>
mov    $0x1f,%edi
call   1030 <print_csi_sgr@plt>
mov    $0x1,%edi
call   1030 <print_csi_sgr@plt>
mov    -0x8(%rbp),%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <reset_attributes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_fail>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    $0x5f,%edi
call   1030 <print_csi_sgr@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1070 <reset_attributes@plt>
mov    $0x1f,%edi
call   1030 <print_csi_sgr@plt>
mov    $0x1,%edi
call   1030 <print_csi_sgr@plt>
lea    0xe68(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe61(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <reset_attributes@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [10 x i8] c"%s failed\00"
@.str.3 = [3 x i8] c": \00"
define void @print_fail(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @print_csi_sgr(i32 95)
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (...) @reset_attributes()
%10 = call i32 @print_csi_sgr(i32 31)
%11 = call i32 @print_csi_sgr(i32 1)
%12 = load i8*, i8** %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (...) @reset_attributes()
ret void
}

LLVM IR (-O2):
@.str.2 = [10 x i8] c"%s failed\00"
@.str.3 = [3 x i8] c": \00"
define void @print_fail(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @print_csi_sgr(i32 95)
%5 = tail call i32 @puts(i8* dereferenceable(1) %1)
%6 = tail call i32 (...) @reset_attributes()
%7 = tail call i32 @print_csi_sgr(i32 31)
%8 = tail call i32 @print_csi_sgr(i32 1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 (...) @reset_attributes()
ret void
}