#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*/ abort();
int /*<<< orphan*/ dump(unsigned long const *, long, unsigned long const *,
                        long, unsigned long const *, unsigned long const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, long, long, long);
int /*<<< orphan*/ stderr;
void check(const unsigned long *a, long m, const unsigned long *b, long n,
           const char *cname, const unsigned long *c, const char *dname,
           const unsigned long *d) {
  long i = 0;
  for (i = 0; i < m + n; i++) {
    if (c[i] != d[i]) {
      fprintf(stderr, "Error: %s and %s differ for %ldx%ld at word %ld\n",
              cname, dname, m, n, i);
      if (m + n < 1000) {
        dump(a, m, b, n, c, d);
      }
      abort();
    }
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jge    1216 <check+0xe6>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x18(%rbp),%rcx
mov    -0x38(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     1200 <check+0xd0>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x38(%rbp),%rax
lea    0xe41(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
cmp    $0x3e8,%rax
jge    11f9 <check+0xc9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x18(%rbp),%r9
call   1040 <dump@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1205 <check+0xd5>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1168 <check+0x38>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    (%rcx,%rsi,1),%r15
test   %r15,%r15
jle    1174 <check+0x44>
mov    %r9,%rbx
mov    %rcx,%r14
mov    %rsi,%r12
mov    %rdi,%r13
mov    0x58(%rsp),%rbp
mov    0x50(%rsp),%rcx
xor    %eax,%eax
nop
mov    (%rbx,%rax,8),%rsi
cmp    0x0(%rbp,%rax,8),%rsi
jne    1183 <check+0x53>
add    $0x1,%rax
cmp    %rax,%r15
jne    1160 <check+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdx,0x10(%rsp)
mov    0x2e51(%rip),%rdx
mov    (%rdx),%edi
mov    %rax,(%rsp)
lea    0xe64(%rip),%rsi
mov    %r8,%rdx
mov    %r12,%r8
mov    %r14,%r9
call   1050 <fprintf@plt>
cmp    $0x3e7,%r15
jg     11cc <check+0x9c>
mov    %r13,%rdi
mov    %r12,%rsi
mov    0x10(%rsp),%rdx
mov    %r14,%rcx
mov    %rbx,%r8
mov    %rbp,%r9
call   1040 <dump@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [49 x i8] c"Error: %s and %s differ for %ldx%ld at word %ld\0A\00"
define void @check(i64* %0, i64 %1, i64* %2, i64 %3, i8* %4, i64* %5, i8* %6, i64* %7) {
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64*
%15 = alloca i8*
%16 = alloca i64*
%17 = alloca i64
store i64* %0, i64** %9
store i64 %1, i64* %10
store i64* %2, i64** %11
store i64 %3, i64* %12
store i8* %4, i8** %13
store i64* %5, i64** %14
store i8* %6, i8** %15
store i64* %7, i64** %16
store i64 0, i64* %17
store i64 0, i64* %17
br label %18
18: ; preds = %57, %8
%19 = load i64, i64* %17
%20 = load i64, i64* %10
%21 = load i64, i64* %12
%22 = add nsw i64 %20, %21
%23 = icmp slt i64 %19, %22
br i1 %23, label %24, label %60
24: ; preds = %18
%25 = load i64*, i64** %14
%26 = load i64, i64* %17
%27 = getelementptr inbounds i64, i64* %25, i64 %26
%28 = load i64, i64* %27
%29 = load i64*, i64** %16
%30 = load i64, i64* %17
%31 = getelementptr inbounds i64, i64* %29, i64 %30
%32 = load i64, i64* %31
%33 = icmp ne i64 %28, %32
br i1 %33, label %34, label %56
34: ; preds = %24
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %13
%37 = load i8*, i8** %15
%38 = load i64, i64* %10
%39 = load i64, i64* %12
%40 = load i64, i64* %17
%41 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %36, i8* %37, i64 %38, i64 %39, i64 %40)
%42 = load i64, i64* %10
%43 = load i64, i64* %12
%44 = add nsw i64 %42, %43
%45 = icmp slt i64 %44, 1000
br i1 %45, label %46, label %54
46: ; preds = %34
%47 = load i64*, i64** %9
%48 = load i64, i64* %10
%49 = load i64*, i64** %11
%50 = load i64, i64* %12
%51 = load i64*, i64** %14
%52 = load i64*, i64** %16
%53 = call i32 @dump(i64* %47, i64 %48, i64* %49, i64 %50, i64* %51, i64* %52)
br label %54
54: ; preds = %46, %34
%55 = call i32 (...) @abort()
unreachable
56: ; preds = %24
br label %57
57: ; preds = %56
%58 = load i64, i64* %17
%59 = add nsw i64 %58, 1
store i64 %59, i64* %17
br label %18
60: ; preds = %18
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"Error: %s and %s differ for %ldx%ld at word %ld\0A\00"
define void @check(i64* %0, i64 %1, i64* %2, i64 %3, i8* %4, i64* %5, i8* %6, i64* %7) {
%9 = add i64 %3, %1
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8, %26
%12 = phi i64 [ %27, %26 ], [ 0, %8 ]
%13 = getelementptr inbounds i64, i64* %5, i64 %12
%14 = load i64, i64* %13
%15 = getelementptr inbounds i64, i64* %7, i64 %12
%16 = load i64, i64* %15
%17 = icmp eq i64 %14, %16
br i1 %17, label %26, label %18
18: ; preds = %11
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i64 %1, i64 %3, i64 %12)
%21 = icmp slt i64 %9, 1000
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = tail call i32 @dump(i64* %0, i64 %1, i64* %2, i64 %3, i64* %5, i64* %7)
br label %24
24: ; preds = %22, %18
%25 = tail call i32 (...) @abort()
unreachable
26: ; preds = %11
%27 = add nuw nsw i64 %12, 1
%28 = icmp eq i64 %27, %9
br i1 %28, label %29, label %11
29: ; preds = %26, %8
ret void
}