#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ xor_block(char *, char *, int);
void raid4_encode(int data_strips, char **data, char **parity, int block_size) {
  int i;
  memcpy(parity[0], data[0], block_size);
  for (i = 1; i < data_strips; i++)
    xor_block(data[i], parity[0], block_size);
  return;
}


x86 assembly (clang, -O0):
<raid4_encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1188 <raid4_encode+0x68>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <xor_block@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1153 <raid4_encode+0x33>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raid4_encode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r12
mov    %rsi,%r13
mov    %edi,%r15d
mov    (%rdx),%rdi
mov    (%rsi),%rsi
mov    %ecx,%edx
call   1030 <memcpy@plt>
cmp    $0x2,%r15d
jl     117a <raid4_encode+0x5a>
mov    %r15d,%ebx
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbp,8),%rdi
mov    (%r12),%rsi
mov    %r14d,%edx
call   1040 <xor_block@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <raid4_encode+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @raid4_encode(i32 %0, i8** %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%10 = load i8**, i8*** %7
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = load i32, i32* %8
%17 = call i32 @memcpy(i8* %12, i8* %15, i32 %16)
store i32 1, i32* %9
br label %18
18: ; preds = %33, %4
%19 = load i32, i32* %9
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %36
22: ; preds = %18
%23 = load i8**, i8*** %6
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %7
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = load i32, i32* %8
%32 = call i32 @xor_block(i8* %27, i8* %30, i32 %31)
br label %33
33: ; preds = %22
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %18
36: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @raid4_encode(i32 %0, i8** nocapture %1, i8** nocapture %2, i32 %3) {
%5 = load i8*, i8** %2
%6 = load i8*, i8** %1
%7 = tail call i32 @memcpy(i8* %5, i8* %6, i32 %3)
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 1, %9 ], [ %17, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = load i8*, i8** %2
%16 = tail call i32 @xor_block(i8* %14, i8* %15, i32 %3)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11, %4
ret void
}