#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 */
struct bBitmapExtBlock {
  int dummy;
};
struct Volume {
  int dummy;
};

/* Variables and functions */
scalar_t__ adfWriteBlock(struct Volume *, long, unsigned char *);
int /*<<< orphan*/ memcpy(unsigned char *, struct bBitmapExtBlock *, int);
long adfWriteBitmapExtBlock(struct Volume *vol, long nSect,
                            struct bBitmapExtBlock *bitme) {
  unsigned char buf[512];
  memcpy(buf, bitme, 512);
  if (adfWriteBlock(vol, nSect, (unsigned char *)buf) != 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<adfWriteBitmapExtBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x200,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x220(%rbp),%rdx
call   1030 <adfWriteBlock@plt>
cmp    $0x0,%rax
je     1177 <adfWriteBitmapExtBlock+0x57>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    117f <adfWriteBitmapExtBlock+0x5f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adfWriteBitmapExtBlock>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    $0x200,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <adfWriteBlock@plt>
neg    %rax
sbb    %rax,%rax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Volume = type { i32 }
%struct.bBitmapExtBlock = type { i32 }
define i64 @adfWriteBitmapExtBlock(%struct.Volume* %0, i64 %1, %struct.bBitmapExtBlock* %2) {
%4 = alloca i64
%5 = alloca %struct.Volume*
%6 = alloca i64
%7 = alloca %struct.bBitmapExtBlock*
%8 = alloca [512 x i8]
store %struct.Volume* %0, %struct.Volume** %5
store i64 %1, i64* %6
store %struct.bBitmapExtBlock* %2, %struct.bBitmapExtBlock** %7
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%10 = load %struct.bBitmapExtBlock*, %struct.bBitmapExtBlock** %7
%11 = call i32 @memcpy(i8* %9, %struct.bBitmapExtBlock* %10, i32 512)
%12 = load %struct.Volume*, %struct.Volume** %5
%13 = load i64, i64* %6
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%15 = call i64 @adfWriteBlock(%struct.Volume* %12, i64 %13, i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i64 -1, i64* %4
br label %19
18: ; preds = %3
store i64 0, i64* %4
br label %19
19: ; preds = %18, %17
%20 = load i64, i64* %4
ret i64 %20
}

LLVM IR (-O2):
%struct.Volume = type { i32 }
%struct.bBitmapExtBlock = type { i32 }
define i64 @adfWriteBitmapExtBlock(%struct.Volume* %0, i64 %1, %struct.bBitmapExtBlock* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @memcpy(i8* %5, %struct.bBitmapExtBlock* %2, i32 512)
%7 = call i64 @adfWriteBlock(%struct.Volume* %0, i64 %1, i8* %5)
%8 = icmp ne i64 %7, 0
%9 = sext i1 %8 to i64
ret i64 %9
}