int block_read_write(unsigned long long offset, unsigned int len, void *buf,
                     int readwrite) {
  *((volatile unsigned int *)((
      ((((((((((0xf0000000)) + (4 * 1024 * 1024)) + (4 * 1024 * 1024)) +
            (4 * 1024 * 1024)) +
           (4 * 1024 * 1024)) +
          (4 * 1024 * 1024)) +
         (4 * 1024 * 1024)) +
        (4 * 1024 * 1024)) +
       (4 * 1024 * 1024)) +
      4))) = (unsigned int)buf;
  *((volatile unsigned long long *)((
      ((((((((((0xf0000000)) + (4 * 1024 * 1024)) + (4 * 1024 * 1024)) +
            (4 * 1024 * 1024)) +
           (4 * 1024 * 1024)) +
          (4 * 1024 * 1024)) +
         (4 * 1024 * 1024)) +
        (4 * 1024 * 1024)) +
       (4 * 1024 * 1024)) +
      8))) = offset;
  *((volatile unsigned int *)((
      ((((((((((0xf0000000)) + (4 * 1024 * 1024)) + (4 * 1024 * 1024)) +
            (4 * 1024 * 1024)) +
           (4 * 1024 * 1024)) +
          (4 * 1024 * 1024)) +
         (4 * 1024 * 1024)) +
        (4 * 1024 * 1024)) +
       (4 * 1024 * 1024)) +
      16))) = len;
  if (readwrite)
    *((volatile unsigned int *)((
        ((((((((((0xf0000000)) + (4 * 1024 * 1024)) + (4 * 1024 * 1024)) +
              (4 * 1024 * 1024)) +
             (4 * 1024 * 1024)) +
            (4 * 1024 * 1024)) +
           (4 * 1024 * 1024)) +
          (4 * 1024 * 1024)) +
         (4 * 1024 * 1024)) +
        0))) = (1);
  else
    *((volatile unsigned int *)((
        ((((((((((0xf0000000)) + (4 * 1024 * 1024)) + (4 * 1024 * 1024)) +
              (4 * 1024 * 1024)) +
             (4 * 1024 * 1024)) +
            (4 * 1024 * 1024)) +
           (4 * 1024 * 1024)) +
          (4 * 1024 * 1024)) +
         (4 * 1024 * 1024)) +
        0))) = (2);
  return 0;
}


x86 assembly (clang, -O0):
<block_read_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    $0xf2000004,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0xf2000008,%eax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%ecx
mov    $0xf2000010,%eax
mov    %ecx,(%rax)
cmpl   $0x0,-0x1c(%rbp)
je     114f <block_read_write+0x4f>
mov    $0xf2000000,%eax
movl   $0x1,(%rax)
jmp    115a <block_read_write+0x5a>
mov    $0xf2000000,%eax
movl   $0x2,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_read_write>:
mov    $0xf2000000,%eax
mov    %edx,0x4(%rax)
mov    %rdi,0x8(%rax)
mov    %esi,0x10(%rax)
cmp    $0x1,%ecx
mov    $0x1,%ecx
adc    $0x0,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @block_read_write(i64 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i64 %0, i64* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %7
%10 = ptrtoint i8* %9 to i32
store volatile i32 %10, i32* inttoptr (i64 4060086276 to i32*)
%11 = load i64, i64* %5
store volatile i64 %11, i64* inttoptr (i64 4060086280 to i64*)
%12 = load i32, i32* %6
store volatile i32 %12, i32* inttoptr (i64 4060086288 to i32*)
%13 = load i32, i32* %8
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %4
store volatile i32 1, i32* inttoptr (i64 4060086272 to i32*)
br label %17
16: ; preds = %4
store volatile i32 2, i32* inttoptr (i64 4060086272 to i32*)
br label %17
17: ; preds = %16, %15
ret i32 0
}

LLVM IR (-O2):
define i32 @block_read_write(i64 %0, i32 %1, i8* %2, i32 %3) {
%5 = ptrtoint i8* %2 to i64
%6 = trunc i64 %5 to i32
store volatile i32 %6, i32* inttoptr (i64 4060086276 to i32*)
store volatile i64 %0, i64* inttoptr (i64 4060086280 to i64*)
store volatile i32 %1, i32* inttoptr (i64 4060086288 to i32*)
%7 = icmp eq i32 %3, 0
%8 = select i1 %7, i32 2, i32 1
store volatile i32 %8, i32* inttoptr (i64 4060086272 to i32*)
ret i32 0
}