#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int);
int /*<<< orphan*/ stderr;
void verify(int *A, int *B, int *C, int N) {
  for (int i = 0; i < N; i++) {
    if (C[i] != A[i] + B[i]) {
      fprintf(stderr,
              "Validation error on element %d. Expected %d, got "
              "%d\n",
              i, A[i] + B[i], C[i]);
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ca <verify+0xaa>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    -0x10(%rbp),%rdx
movslq -0x20(%rbp),%rsi
add    (%rdx,%rsi,4),%ecx
cmp    %ecx,%eax
je     11b7 <verify+0x97>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rsi
add    (%rax,%rsi,4),%ecx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rsi
mov    (%rax,%rsi,4),%r8d
lea    0xe58(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    11bc <verify+0x9c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113e <verify+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify>:
push   %rax
test   %ecx,%ecx
jle    1148 <verify+0x28>
mov    %ecx,%r9d
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
mov    (%rdx,%rax,4),%r8d
mov    (%rsi,%rax,4),%ecx
add    (%rdi,%rax,4),%ecx
cmp    %ecx,%r8d
jne    114a <verify+0x2a>
add    $0x1,%rax
cmp    %rax,%r9
jne    1130 <verify+0x10>
pop    %rax
ret
mov    0x2e8f(%rip),%rdx
mov    (%rdx),%edi
lea    0xea6(%rip),%rsi
mov    %eax,%edx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Validation error on element %d. Expected %d, got %d\0A\00"
define void @verify(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %9
8: ; preds = %24, %4
ret void
9: ; preds = %6, %24
%10 = phi i64 [ 0, %6 ], [ %25, %24 ]
%11 = getelementptr inbounds i32, i32* %2, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %0, i64 %10
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %1, i64 %10
%16 = load i32, i32* %15
%17 = add nsw i32 %16, %14
%18 = icmp eq i32 %12, %17
br i1 %18, label %24, label %19
19: ; preds = %9
%20 = trunc i64 %10 to i32
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %17, i32 %12)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %9
%25 = add nuw nsw i64 %10, 1
%26 = icmp eq i64 %25, %7
br i1 %26, label %8, label %9
}