#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*/ basic_test(int);
int /*<<< orphan*/ cleanup_test();
int cmp_crc_log_wr_phys1_rd(size_t);
int /*<<< orphan*/ flush_disk_buffers();
int /*<<< orphan*/ init_test();
int /*<<< orphan*/ log_fill_buffer(size_t);
int /*<<< orphan*/ log_write_start(size_t);
int /*<<< orphan*/ phys1_read_start(size_t);
void write_one_sector_check_phys1_crc(void) {
  int rc;
  size_t len = 512;
  init_test();
  log_fill_buffer(len);
  log_write_start(len);
  flush_disk_buffers();
  phys1_read_start(len);
  rc = cmp_crc_log_wr_phys1_rd(len);
  basic_test(rc == 0);
  cleanup_test();
}


x86 assembly (clang, -O0):
<write_one_sector_check_phys1_crc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x200,-0x10(%rbp)
mov    $0x0,%al
call   1090 <init_test@plt>
mov    -0x10(%rbp),%rdi
call   1040 <log_fill_buffer@plt>
mov    -0x10(%rbp),%rdi
call   1080 <log_write_start@plt>
mov    $0x0,%al
call   10a0 <flush_disk_buffers@plt>
mov    -0x10(%rbp),%rdi
call   1030 <phys1_read_start@plt>
mov    -0x10(%rbp),%rdi
call   1060 <cmp_crc_log_wr_phys1_rd@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <basic_test@plt>
mov    $0x0,%al
call   1070 <cleanup_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_one_sector_check_phys1_crc>:
push   %rax
xor    %eax,%eax
call   1090 <init_test@plt>
mov    $0x200,%edi
call   1040 <log_fill_buffer@plt>
mov    $0x200,%edi
call   1080 <log_write_start@plt>
xor    %eax,%eax
call   10a0 <flush_disk_buffers@plt>
mov    $0x200,%edi
call   1030 <phys1_read_start@plt>
mov    $0x200,%edi
call   1060 <cmp_crc_log_wr_phys1_rd@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <basic_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <cleanup_test@plt>

LLVM IR (-O0):
define void @write_one_sector_check_phys1_crc() {
%1 = alloca i32
%2 = alloca i64
store i64 512, i64* %2
%3 = call i32 (...) @init_test()
%4 = load i64, i64* %2
%5 = call i32 @log_fill_buffer(i64 %4)
%6 = load i64, i64* %2
%7 = call i32 @log_write_start(i64 %6)
%8 = call i32 (...) @flush_disk_buffers()
%9 = load i64, i64* %2
%10 = call i32 @phys1_read_start(i64 %9)
%11 = load i64, i64* %2
%12 = call i32 @cmp_crc_log_wr_phys1_rd(i64 %11)
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @basic_test(i32 %15)
%17 = call i32 (...) @cleanup_test()
ret void
}

LLVM IR (-O2):
define void @write_one_sector_check_phys1_crc() {
%1 = tail call i32 (...) @init_test()
%2 = tail call i32 @log_fill_buffer(i64 512)
%3 = tail call i32 @log_write_start(i64 512)
%4 = tail call i32 (...) @flush_disk_buffers()
%5 = tail call i32 @phys1_read_start(i64 512)
%6 = tail call i32 @cmp_crc_log_wr_phys1_rd(i64 512)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @basic_test(i32 %8)
%10 = tail call i32 (...) @cleanup_test()
ret void
}