#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*/ burn_rspc_p0p1(unsigned char *, int, unsigned char *,
                                  unsigned char *, unsigned char *,
                                  unsigned char *);
void burn_rspc_parity_p(unsigned char *sector) {
  int i;
  unsigned char p0_lsb, p0_msb, p1_lsb, p1_msb;
  for (i = 0; i < 43; i++) {
    burn_rspc_p0p1(sector, i, &p0_lsb, &p0_msb, &p1_lsb, &p1_msb);
    sector[2162 + 2 * i] = p0_lsb;
    sector[2162 + 2 * i + 1] = p0_msb;
    sector[2076 + 2 * i] = p1_lsb;
    sector[2076 + 2 * i + 1] = p1_msb;
  }
}


x86 assembly (clang, -O0):
<burn_rspc_parity_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2b,-0xc(%rbp)
jge    11c1 <burn_rspc_parity_p+0xb1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0xd(%rbp),%rdx
lea    -0xe(%rbp),%rcx
lea    -0xf(%rbp),%r8
lea    -0x10(%rbp),%r9
call   1030 <burn_rspc_p0p1@plt>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x872,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xe(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x872,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xf(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x81c,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x81c,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <burn_rspc_parity_p+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<burn_rspc_parity_p>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0x7(%rsp),%r15
lea    0x6(%rsp),%r12
lea    0x5(%rsp),%r13
lea    0x4(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
mov    %rbp,%r9
call   1030 <burn_rspc_p0p1@plt>
movzbl 0x7(%rsp),%eax
mov    %al,0x872(%r14,%rbx,2)
movzbl 0x6(%rsp),%eax
mov    %al,0x873(%r14,%rbx,2)
movzbl 0x5(%rsp),%eax
mov    %al,0x81c(%r14,%rbx,2)
movzbl 0x4(%rsp),%eax
mov    %al,0x81d(%r14,%rbx,2)
add    $0x1,%rbx
cmp    $0x2b,%rbx
jne    1140 <burn_rspc_parity_p+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @burn_rspc_parity_p(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
br label %8
8: ; preds = %45, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 43
br i1 %10, label %11, label %48
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = call i32 @burn_rspc_p0p1(i8* %12, i32 %13, i8* %4, i8* %5, i8* %6, i8* %7)
%15 = load i8, i8* %4
%16 = load i8*, i8** %2
%17 = load i32, i32* %3
%18 = mul nsw i32 2, %17
%19 = add nsw i32 2162, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %16, i64 %20
store i8 %15, i8* %21
%22 = load i8, i8* %5
%23 = load i8*, i8** %2
%24 = load i32, i32* %3
%25 = mul nsw i32 2, %24
%26 = add nsw i32 2162, %25
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %23, i64 %28
store i8 %22, i8* %29
%30 = load i8, i8* %6
%31 = load i8*, i8** %2
%32 = load i32, i32* %3
%33 = mul nsw i32 2, %32
%34 = add nsw i32 2076, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %31, i64 %35
store i8 %30, i8* %36
%37 = load i8, i8* %7
%38 = load i8*, i8** %2
%39 = load i32, i32* %3
%40 = mul nsw i32 2, %39
%41 = add nsw i32 2076, %40
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %38, i64 %43
store i8 %37, i8* %44
br label %45
45: ; preds = %11
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %8
48: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @burn_rspc_parity_p(i8* %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
br label %6
6: ; preds = %1, %6
%7 = phi i64 [ 0, %1 ], [ %23, %6 ]
%8 = trunc i64 %7 to i32
%9 = call i32 @burn_rspc_p0p1(i8* %0, i32 %8, i8* %2, i8* %3, i8* %4, i8* %5)
%10 = load i8, i8* %2
%11 = shl nuw nsw i64 %7, 1
%12 = add nuw nsw i64 %11, 2162
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 %10, i8* %13
%14 = load i8, i8* %3
%15 = add nuw nsw i64 %11, 2163
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 %14, i8* %16
%17 = load i8, i8* %4
%18 = add nuw nsw i64 %11, 2076
%19 = getelementptr inbounds i8, i8* %0, i64 %18
store i8 %17, i8* %19
%20 = load i8, i8* %5
%21 = add nuw nsw i64 %11, 2077
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 %20, i8* %22
%23 = add nuw nsw i64 %7, 1
%24 = icmp eq i64 %23, 43
br i1 %24, label %25, label %6
25: ; preds = %6
ret void
}