#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*/ printf(char *, int);
int check(char *p1, char *p2, int size, int code) {
  int i;
  for (i = 0; i < size; i++) {
    if (p1[i] != p2[i]) {
      {
        printf("Error %d\n", (int)code);
        exit(code);
      };
    }
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1193 <check+0x73>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1180 <check+0x60>
mov    -0x20(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%edi
call   1040 <exit@plt>
jmp    1185 <check+0x65>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <check+0x1d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbx
test   %edx,%edx
jle    1142 <check+0x22>
mov    %ecx,%ebx
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rcx,1),%edx
cmp    (%rsi,%rcx,1),%dl
jne    1144 <check+0x24>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1130 <check+0x10>
pop    %rbx
ret
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Error %d\0A\00"
define i32 @check(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 0, i32* %10
br label %11
11: ; preds = %35, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %38
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8*, i8** %7
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %21, %27
br i1 %28, label %29, label %34
29: ; preds = %15
%30 = load i32, i32* %9
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %9
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %15
br label %35
35: ; preds = %34
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 1
store i32 %37, i32* %10
br label %11
38: ; preds = %11
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
@.str = [10 x i8] c"Error %d\0A\00"
define i32 @check(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %21
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %17, %7
br i1 %9, label %21, label %10
10: ; preds = %6, %8
%11 = phi i64 [ 0, %6 ], [ %17, %8 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %1, i64 %11
%15 = load i8, i8* %14
%16 = icmp eq i8 %13, %15
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %8, label %18
18: ; preds = %10
%19 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%20 = tail call i32 @exit(i32 %3)
unreachable
21: ; preds = %8, %4
ret i32 undef
}