#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int rnc_sub(char *, int, char const *, char const *);
int /*<<< orphan*/ stderr;
int _sub_fail(const char *l, const char *r) {
  char buf[256] = {'u', 'n', 'i', 't', 'i', 'a', 'l', 'i', 'z', 'e', 'd'};
  int actual_ret = rnc_sub(buf, sizeof(buf), l, r);
  if (0 == actual_ret) {
    fprintf(stderr, "Did not fail when subtracting %s - %s\n", l, r);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_sub_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x100,%esi
call   1030 <rnc_sub@plt>
mov    %eax,-0x124(%rbp)
xor    %eax,%eax
cmp    -0x124(%rbp),%eax
jne    11b1 <_sub_fail+0x81>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xf60(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <_sub_fail+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sub_fail>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xeb7(%rip),%rsi
mov    %rsp,%rbx
mov    $0x100,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <rnc_sub@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    1194 <_sub_fail+0x64>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xf7c(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const._sub_fail.buf = <{ [11 x i8], [245 x i8] }> <{ [11 x i8] c"unitialized", [245 x i8] zeroinitializer }>
@stderr = global i32 0
@.str = [39 x i8] c"Did not fail when subtracting %s - %s\0A\00"
define i32 @_sub_fail(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [256 x i8]
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = bitcast [256 x i8]* %6 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = call i32 @rnc_sub(i8* %9, i32 256, i8* %10, i8* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp eq i32 0, %13
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
store i32 1, i32* %3
br label %21
20: ; preds = %2
store i32 0, i32* %3
br label %21
21: ; preds = %20, %15
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@__const._sub_fail.buf = <{ [11 x i8], [245 x i8] }> <{ [11 x i8] c"unitialized", [245 x i8] zeroinitializer }>
@stderr = global i32 0
@.str = [39 x i8] c"Did not fail when subtracting %s - %s\0A\00"
define i32 @_sub_fail(i8* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @rnc_sub(i8* %4, i32 256, i8* %0, i8* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %11
}