#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*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, size_t);
int rnc_add(char *, size_t, char const *, char const *);
int /*<<< orphan*/ stderr;
int _add_fail(const char *l, const char *r, size_t buflen) {
  char buf[256] = {'u', 'n', 'i', 't', 'i', 'a', 'l', 'i', 'z', 'e', 'd'};
  int actual_ret = rnc_add(buf, buflen, l, r);
  if (0 == actual_ret) {
    fprintf(stderr,
            "Did not fail when putting %s + %s in a %lu character buffer\n", l,
            r, buflen);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_add_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
lea    0xeab(%rip),%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <rnc_add@plt>
mov    %eax,-0x124(%rbp)
xor    %eax,%eax
cmp    -0x124(%rbp),%eax
jne    11b8 <_add_fail+0x88>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xf59(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bf <_add_fail+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_add_fail>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeb2(%rip),%rsi
mov    %rsp,%rbx
mov    $0x100,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <rnc_add@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    119a <_add_fail+0x6a>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xf79(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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