void SL11BufRead(short address, unsigned char *buffer, short byte_count) {
  if (byte_count <= 0)
    return;
  *((volatile unsigned char *)(((long unsigned int)(int)0xa0000000) |
                               (0x100C0000))) = (address);
  while (byte_count--)
    *buffer++ =
        (*((volatile unsigned char *)(((long unsigned int)(int)0xa0000000) |
                                      (0x100C0000 + 8))));
}


x86 assembly (clang, -O0):
<SL11BufRead>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movswl -0x12(%rbp),%eax
cmp    $0x0,%eax
jg     1128 <SL11BufRead+0x28>
jmp    116f <SL11BufRead+0x6f>
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    $0xffffffffb00c0000,%rax
mov    %cl,(%rax)
mov    -0x12(%rbp),%ax
mov    %ax,%cx
add    $0xffff,%cx
mov    %cx,-0x12(%rbp)
cmp    $0x0,%ax
je     116f <SL11BufRead+0x6f>
mov    $0xffffffffb00c0008,%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1137 <SL11BufRead+0x37>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SL11BufRead>:
test   %dx,%dx
jle    11c8 <SL11BufRead+0xc8>
mov    %dil,0xffffffffb00c0000
b0
lea    -0x1(%rdx),%r8d
test   $0x7,%dl
je     1149 <SL11BufRead+0x49>
movzwl %dx,%edi
and    $0x7,%edi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0xffffffffb00c0008,%eax
b0
mov    %al,(%rsi,%rcx,1)
add    $0x1,%rcx
cmp    %cx,%di
jne    1130 <SL11BufRead+0x30>
sub    %ecx,%edx
add    %rcx,%rsi
cmp    $0x7,%r8w
jb     11c8 <SL11BufRead+0xc8>
movzwl %dx,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x1(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x2(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x3(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x4(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x5(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x6(%rsi,%rcx,1)
movzbl 0xffffffffb00c0008,%edx
b0
mov    %dl,0x7(%rsi,%rcx,1)
add    $0x8,%rcx
cmp    %cx,%ax
jne    1160 <SL11BufRead+0x60>
ret

LLVM IR (-O0):
define void @SL11BufRead(i16 signext %0, i8* %1, i16 signext %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i16
store i16 %0, i16* %4
store i8* %1, i8** %5
store i16 %2, i16* %6
%7 = load i16, i16* %6
%8 = sext i16 %7 to i32
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
br label %22
11: ; preds = %3
%12 = load i16, i16* %4
%13 = trunc i16 %12 to i8
store volatile i8 %13, i8* inttoptr (i64 -1341390848 to i8*)
br label %14
14: ; preds = %18, %11
%15 = load i16, i16* %6
%16 = add i16 %15, -1
store i16 %16, i16* %6
%17 = icmp ne i16 %15, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %5
store i8 %19, i8* %20
br label %14
22: ; preds = %10, %14
ret void
}

LLVM IR (-O2):
define void @SL11BufRead(i16 signext %0, i8* nocapture writeonly %1, i16 signext %2) {
%4 = icmp slt i16 %2, 1
br i1 %4, label %44, label %5
5: ; preds = %3
%6 = trunc i16 %0 to i8
store volatile i8 %6, i8* inttoptr (i64 -1341390848 to i8*)
%7 = add i16 %2, -1
%8 = and i16 %2, 7
%9 = icmp eq i16 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %5, %10
%11 = phi i16 [ %14, %10 ], [ %2, %5 ]
%12 = phi i8* [ %16, %10 ], [ %1, %5 ]
%13 = phi i16 [ %17, %10 ], [ 0, %5 ]
%14 = add i16 %11, -1
%15 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%16 = getelementptr inbounds i8, i8* %12, i64 1
store i8 %15, i8* %12
%17 = add i16 %13, 1
%18 = icmp eq i16 %17, %8
br i1 %18, label %19, label %10
19: ; preds = %10, %5
%20 = phi i16 [ %2, %5 ], [ %14, %10 ]
%21 = phi i8* [ %1, %5 ], [ %16, %10 ]
%22 = icmp ult i16 %7, 7
br i1 %22, label %44, label %23
23: ; preds = %19, %23
%24 = phi i16 [ %40, %23 ], [ %20, %19 ]
%25 = phi i8* [ %42, %23 ], [ %21, %19 ]
%26 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%27 = getelementptr inbounds i8, i8* %25, i64 1
store i8 %26, i8* %25
%28 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%29 = getelementptr inbounds i8, i8* %25, i64 2
store i8 %28, i8* %27
%30 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%31 = getelementptr inbounds i8, i8* %25, i64 3
store i8 %30, i8* %29
%32 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%33 = getelementptr inbounds i8, i8* %25, i64 4
store i8 %32, i8* %31
%34 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%35 = getelementptr inbounds i8, i8* %25, i64 5
store i8 %34, i8* %33
%36 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%37 = getelementptr inbounds i8, i8* %25, i64 6
store i8 %36, i8* %35
%38 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%39 = getelementptr inbounds i8, i8* %25, i64 7
store i8 %38, i8* %37
%40 = add i16 %24, -8
%41 = load volatile i8, i8* inttoptr (i64 -1341390840 to i8*)
%42 = getelementptr inbounds i8, i8* %25, i64 8
store i8 %41, i8* %39
%43 = icmp eq i16 %40, 0
br i1 %43, label %44, label %23
44: ; preds = %19, %23, %3
ret void
}