#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*/ actual_dif;

/* 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;
scalar_t__ strcmp(char const *, char *);
int _sub(const char *l, const char *r, const char *expected_dif) {
  char actual_dif[256] = {'u', 'n', 'i', 't', 'i', 'a',
                          'l', 'i', 'z', 'e', 'd'};
  int actual_ret = rnc_sub(actual_dif, sizeof(actual_dif), l, r);
  if (0 != actual_ret) {
    fprintf(stderr, "Failed subtracting %s - %s: ret = %d\n", l, r, actual_ret);
    return 1;
  }
  if (0 != strcmp(expected_dif, actual_dif)) {
    fprintf(stderr, "Failed subtracting %s - %s: %s != %s\n", l, r, actual_dif,
            expected_dif);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_sub>:
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    0xe9b(%rip),%rsi
mov    $0x100,%edx
call   1060 <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
je     11ce <_sub+0x8e>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x124(%rbp),%r8d
lea    0xf45(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1229 <_sub+0xe9>
mov    -0x20(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1222 <_sub+0xe2>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x120(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xf17(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1229 <_sub+0xe9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sub>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xea2(%rip),%rsi
mov    %rsp,%rbx
mov    $0x100,%edx
mov    %rbx,%rdi
call   1060 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r12,%rdx
mov    %r14,%rcx
call   1030 <rnc_sub@plt>
test   %eax,%eax
je     11a7 <_sub+0x67>
mov    0x2e54(%rip),%rcx
mov    (%rcx),%edi
lea    0xf6b(%rip),%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11da <_sub+0x9a>
mov    %rsp,%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11ee <_sub+0xae>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xf5f(%rip),%rsi
mov    %rsp,%r8
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15,%r9
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %eax,%eax
jmp    11df <_sub+0x9f>

LLVM IR (-O0):
@__const._sub.actual_dif = <{ [11 x i8], [245 x i8] }> <{ [11 x i8] c"unitialized", [245 x i8] zeroinitializer }>
@stderr = global i32 0
@.str = [38 x i8] c"Failed subtracting %s - %s: ret = %d\0A\00"
@.str.1 = [38 x i8] c"Failed subtracting %s - %s: %s != %s\0A\00"
define i32 @_sub(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [256 x i8]
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %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 i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32 @rnc_sub(i8* %11, i32 256, i8* %12, i8* %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp ne i32 0, %15
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %5
%20 = load i8*, i8** %6
%21 = load i32, i32* %9
%22 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20, i32 %21)
store i32 1, i32* %4
br label %36
23: ; preds = %3
%24 = load i8*, i8** %7
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp ne i64 0, %26
br i1 %27, label %28, label %35
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %5
%31 = load i8*, i8** %6
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%33 = load i8*, i8** %7
%34 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %30, i8* %31, i8* %32, i8* %33)
store i32 1, i32* %4
br label %36
35: ; preds = %23
store i32 0, i32* %4
br label %36
36: ; preds = %35, %28, %17
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
@__const._sub.actual_dif = <{ [11 x i8], [245 x i8] }> <{ [11 x i8] c"unitialized", [245 x i8] zeroinitializer }>
@stderr = global i32 0
@.str = [38 x i8] c"Failed subtracting %s - %s: ret = %d\0A\00"
@.str.1 = [38 x i8] c"Failed subtracting %s - %s: %s != %s\0A\00"
define i32 @_sub(i8* %0, i8* %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @rnc_sub(i8* %5, i32 256, i8* %0, i8* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %6)
br label %17
11: ; preds = %3
%12 = call i64 @strcmp(i8* %2, i8* %5)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1, i8* %5, i8* %2)
br label %17
17: ; preds = %11, %14, %8
%18 = phi i32 [ 1, %8 ], [ 1, %14 ], [ 0, %11 ]
ret i32 %18
}