#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*/ cylindre_of_bloc(unsigned int, unsigned int);
int /*<<< orphan*/ sector_of_bloc(unsigned int, unsigned int);
int /*<<< orphan*/ write_sector_n(int /*<<< orphan*/, int /*<<< orphan*/,
                                  unsigned char *, unsigned int);
void write_bloc_n(unsigned int vol, unsigned int blk, unsigned char *buffer,
                  unsigned int n) {
  if (vol < 8 && blk < 512) {
    write_sector_n(cylindre_of_bloc(vol, blk), sector_of_bloc(vol, blk), buffer,
                   n);
  }
}


x86 assembly (clang, -O0):
<write_bloc_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x8,-0x4(%rbp)
jae    1186 <write_bloc_n+0x56>
cmpl   $0x200,-0x8(%rbp)
jae    1186 <write_bloc_n+0x56>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <cylindre_of_bloc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <sector_of_bloc@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <write_sector_n@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_bloc_n>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x7,%edi
ja     117a <write_bloc_n+0x4a>
mov    %esi,%ebp
cmp    $0x1ff,%esi
ja     117a <write_bloc_n+0x4a>
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %edi,%ebx
mov    %ebp,%esi
call   1040 <cylindre_of_bloc@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <sector_of_bloc@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write_sector_n@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @write_bloc_n(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp ult i32 %9, 8
br i1 %10, label %11, label %24
11: ; preds = %4
%12 = load i32, i32* %6
%13 = icmp ult i32 %12, 512
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @cylindre_of_bloc(i32 %15, i32 %16)
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = call i32 @sector_of_bloc(i32 %18, i32 %19)
%21 = load i8*, i8** %7
%22 = load i32, i32* %8
%23 = call i32 @write_sector_n(i32 %17, i32 %20, i8* %21, i32 %22)
br label %24
24: ; preds = %14, %11, %4
ret void
}

LLVM IR (-O2):
define void @write_bloc_n(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp ult i32 %0, 8
%6 = icmp ult i32 %1, 512
%7 = and i1 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 @cylindre_of_bloc(i32 %0, i32 %1)
%10 = tail call i32 @sector_of_bloc(i32 %0, i32 %1)
%11 = tail call i32 @write_sector_n(i32 %9, i32 %10, i8* %2, i32 %3)
br label %12
12: ; preds = %8, %4
ret void
}