#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 *, ...);
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;
  int error = 0;
  for (i = 0; i < m + n; i++) {
    if (c[i] != d[i]) {
      if (error++ < 10) {
        fprintf(stderr, "Error: %s and %s differ for %ldx%ld at word %ld\n",
                cname, dname, m, n, i);
        fprintf(stderr, "expected %lx, got %lx\n", c[i], d[i]);
      }
    }
  }
  if (error) {
    if (m + n < 1000) {
      dump(a, m, b, n, c, d);
    }
    abort();
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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)
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jge    122f <check+0xff>
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     1219 <check+0xe9>
mov    -0x3c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x3c(%rbp)
cmp    $0xa,%eax
jge    1214 <check+0xe4>
mov    0x2e23(%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    0xe26(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1219 <check+0xe9>
jmp    121e <check+0xee>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    116f <check+0x3f>
cmpl   $0x0,-0x3c(%rbp)
je     1271 <check+0x141>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
cmp    $0x3e8,%rax
jge    126a <check+0x13a>
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>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,0x30(%rsp)
mov    %rdx,0x28(%rsp)
mov    %rdi,0x20(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rsi,0x10(%rsp)
lea    (%rcx,%rsi,1),%r13
test   %r13,%r13
jle    11f2 <check+0xc2>
mov    %r9,%rbx
mov    0x78(%rsp),%rbp
xor    %eax,%eax
xor    %r15d,%r15d
jmp    118c <check+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14d,%eax
add    $0x1,%r15
cmp    %r15,%r13
je     11ee <check+0xbe>
mov    (%rbx,%r15,8),%rcx
cmp    0x0(%rbp,%r15,8),%rcx
je     1183 <check+0x53>
lea    0x1(%rax),%r14d
cmp    $0x9,%eax
jg     1180 <check+0x50>
mov    0x2e39(%rip),%r12
mov    (%r12),%edi
mov    %r15,(%rsp)
lea    0xe4a(%rip),%rsi
mov    0x30(%rsp),%rdx
mov    0x70(%rsp),%rcx
mov    0x10(%rsp),%r8
mov    0x18(%rsp),%r9
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r12),%edi
mov    (%rbx,%r15,8),%rdx
mov    0x0(%rbp,%r15,8),%rcx
lea    0xe4c(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1180 <check+0x50>
test   %eax,%eax
jne    1201 <check+0xd1>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x3e7,%r13
jg     1229 <check+0xf9>
mov    0x20(%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    0x28(%rsp),%rdx
mov    0x18(%rsp),%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"
@.str.1 = [23 x i8] c"expected %lx, got %lx\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
%18 = alloca i32
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 i32 0, i32* %18
store i64 0, i64* %17
br label %19
19: ; preds = %59, %8
%20 = load i64, i64* %17
%21 = load i64, i64* %10
%22 = load i64, i64* %12
%23 = add nsw i64 %21, %22
%24 = icmp slt i64 %20, %23
br i1 %24, label %25, label %62
25: ; preds = %19
%26 = load i64*, i64** %14
%27 = load i64, i64* %17
%28 = getelementptr inbounds i64, i64* %26, i64 %27
%29 = load i64, i64* %28
%30 = load i64*, i64** %16
%31 = load i64, i64* %17
%32 = getelementptr inbounds i64, i64* %30, i64 %31
%33 = load i64, i64* %32
%34 = icmp ne i64 %29, %33
br i1 %34, label %35, label %58
35: ; preds = %25
%36 = load i32, i32* %18
%37 = add nsw i32 %36, 1
store i32 %37, i32* %18
%38 = icmp slt i32 %36, 10
br i1 %38, label %39, label %57
39: ; preds = %35
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %13
%42 = load i8*, i8** %15
%43 = load i64, i64* %10
%44 = load i64, i64* %12
%45 = load i64, i64* %17
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %41, i8* %42, i64 %43, i64 %44, i64 %45)
%47 = load i32, i32* @stderr
%48 = load i64*, i64** %14
%49 = load i64, i64* %17
%50 = getelementptr inbounds i64, i64* %48, i64 %49
%51 = load i64, i64* %50
%52 = load i64*, i64** %16
%53 = load i64, i64* %17
%54 = getelementptr inbounds i64, i64* %52, i64 %53
%55 = load i64, i64* %54
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i64 %51, i64 %55)
br label %57
57: ; preds = %39, %35
br label %58
58: ; preds = %57, %25
br label %59
59: ; preds = %58
%60 = load i64, i64* %17
%61 = add nsw i64 %60, 1
store i64 %61, i64* %17
br label %19
62: ; preds = %19
%63 = load i32, i32* %18
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %80
65: ; preds = %62
%66 = load i64, i64* %10
%67 = load i64, i64* %12
%68 = add nsw i64 %66, %67
%69 = icmp slt i64 %68, 1000
br i1 %69, label %70, label %78
70: ; preds = %65
%71 = load i64*, i64** %9
%72 = load i64, i64* %10
%73 = load i64*, i64** %11
%74 = load i64, i64* %12
%75 = load i64*, i64** %14
%76 = load i64*, i64** %16
%77 = call i32 @dump(i64* %71, i64 %72, i64* %73, i64 %74, i64* %75, i64* %76)
br label %78
78: ; preds = %70, %65
%79 = call i32 (...) @abort()
unreachable
80: ; preds = %62
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"
@.str.1 = [23 x i8] c"expected %lx, got %lx\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 %41
11: ; preds = %8, %29
%12 = phi i32 [ %30, %29 ], [ 0, %8 ]
%13 = phi i64 [ %31, %29 ], [ 0, %8 ]
%14 = getelementptr inbounds i64, i64* %5, i64 %13
%15 = load i64, i64* %14
%16 = getelementptr inbounds i64, i64* %7, i64 %13
%17 = load i64, i64* %16
%18 = icmp eq i64 %15, %17
br i1 %18, label %29, label %19
19: ; preds = %11
%20 = add nsw i32 %12, 1
%21 = icmp slt i32 %12, 10
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i64 %1, i64 %3, i64 %13)
%25 = load i32, i32* @stderr
%26 = load i64, i64* %14
%27 = load i64, i64* %16
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i64 %26, i64 %27)
br label %29
29: ; preds = %11, %22, %19
%30 = phi i32 [ %20, %22 ], [ %20, %19 ], [ %12, %11 ]
%31 = add nuw nsw i64 %13, 1
%32 = icmp eq i64 %31, %9
br i1 %32, label %33, label %11
33: ; preds = %29
%34 = icmp eq i32 %30, 0
br i1 %34, label %41, label %35
35: ; preds = %33
%36 = icmp slt i64 %9, 1000
br i1 %36, label %37, label %39
37: ; preds = %35
%38 = tail call i32 @dump(i64* %0, i64 %1, i64* %2, i64 %3, i64* %5, i64* %7)
br label %39
39: ; preds = %37, %35
%40 = tail call i32 (...) @abort()
unreachable
41: ; preds = %8, %33
ret void
}