#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*/ CE_High();
int /*<<< orphan*/ CE_Low();
unsigned char Get_Byte();
int /*<<< orphan*/ Send_Byte(int);
int /*<<< orphan*/ printProgress(unsigned long, unsigned long);
void HighSpeed_Read_Cont(unsigned long Dst, unsigned long no_bytes,
                         unsigned char *buffer) {
  unsigned long i = 0;
  CE_Low();
  Send_Byte(0x0B);
  Send_Byte(((Dst & 0xFFFFFF) >> 16));
  Send_Byte(((Dst & 0xFFFF) >> 8));
  Send_Byte(Dst & 0xFF);
  Send_Byte(0xFF);
  for (i = 0; i < no_bytes; i++) {
    if (i % 256 == 255)
      printProgress(i + 1, no_bytes);
    buffer[i] = Get_Byte();
  }
  CE_High();
}


x86 assembly (clang, -O0):
<HighSpeed_Read_Cont>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1070 <CE_Low@plt>
mov    $0xb,%edi
call   1040 <Send_Byte@plt>
mov    -0x8(%rbp),%rax
and    $0xffffff,%rax
shr    $0x10,%rax
mov    %eax,%edi
call   1040 <Send_Byte@plt>
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
shr    $0x8,%rax
mov    %eax,%edi
call   1040 <Send_Byte@plt>
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %eax,%edi
call   1040 <Send_Byte@plt>
mov    $0xff,%edi
call   1040 <Send_Byte@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1224 <HighSpeed_Read_Cont+0xd4>
mov    -0x20(%rbp),%rax
and    $0xff,%rax
cmp    $0xff,%rax
jne    11ff <HighSpeed_Read_Cont+0xaf>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1060 <printProgress@plt>
mov    $0x0,%al
call   1030 <Get_Byte@plt>
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11ca <HighSpeed_Read_Cont+0x7a>
mov    $0x0,%al
call   1050 <CE_High@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HighSpeed_Read_Cont>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <CE_Low@plt>
mov    $0xb,%edi
call   1040 <Send_Byte@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1040 <Send_Byte@plt>
movzbl %bh,%edi
call   1040 <Send_Byte@plt>
movzbl %bl,%edi
call   1040 <Send_Byte@plt>
mov    $0xff,%edi
call   1040 <Send_Byte@plt>
test   %r15,%r15
je     11d9 <HighSpeed_Read_Cont+0x89>
xor    %ebx,%ebx
jmp    11c3 <HighSpeed_Read_Cont+0x73>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <Get_Byte@plt>
mov    %al,(%r14,%rbx,1)
mov    %r12,%rbx
cmp    %r12,%r15
je     11d9 <HighSpeed_Read_Cont+0x89>
lea    0x1(%rbx),%r12
cmp    $0xff,%bl
jne    11b0 <HighSpeed_Read_Cont+0x60>
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <printProgress@plt>
jmp    11b0 <HighSpeed_Read_Cont+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <CE_High@plt>

LLVM IR (-O0):
define void @HighSpeed_Read_Cont(i64 %0, i64 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8* %2, i8** %6
store i64 0, i64* %7
%8 = call i32 (...) @CE_Low()
%9 = call i32 @Send_Byte(i32 11)
%10 = load i64, i64* %4
%11 = and i64 %10, 16777215
%12 = lshr i64 %11, 16
%13 = trunc i64 %12 to i32
%14 = call i32 @Send_Byte(i32 %13)
%15 = load i64, i64* %4
%16 = and i64 %15, 65535
%17 = lshr i64 %16, 8
%18 = trunc i64 %17 to i32
%19 = call i32 @Send_Byte(i32 %18)
%20 = load i64, i64* %4
%21 = and i64 %20, 255
%22 = trunc i64 %21 to i32
%23 = call i32 @Send_Byte(i32 %22)
%24 = call i32 @Send_Byte(i32 255)
store i64 0, i64* %7
br label %25
25: ; preds = %43, %3
%26 = load i64, i64* %7
%27 = load i64, i64* %5
%28 = icmp ult i64 %26, %27
br i1 %28, label %29, label %46
29: ; preds = %25
%30 = load i64, i64* %7
%31 = urem i64 %30, 256
%32 = icmp eq i64 %31, 255
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = load i64, i64* %7
%35 = add i64 %34, 1
%36 = load i64, i64* %5
%37 = call i32 @printProgress(i64 %35, i64 %36)
br label %38
38: ; preds = %33, %29
%39 = call zeroext i8 (...) @Get_Byte()
%40 = load i8*, i8** %6
%41 = load i64, i64* %7
%42 = getelementptr inbounds i8, i8* %40, i64 %41
store i8 %39, i8* %42
br label %43
43: ; preds = %38
%44 = load i64, i64* %7
%45 = add i64 %44, 1
store i64 %45, i64* %7
br label %25
46: ; preds = %25
%47 = call i32 (...) @CE_High()
ret void
}

LLVM IR (-O2):
define void @HighSpeed_Read_Cont(i64 %0, i64 %1, i8* nocapture writeonly %2) {
%4 = tail call i32 (...) @CE_Low()
%5 = tail call i32 @Send_Byte(i32 11)
%6 = trunc i64 %0 to i32
%7 = lshr i32 %6, 16
%8 = and i32 %7, 255
%9 = tail call i32 @Send_Byte(i32 %8)
%10 = lshr i32 %6, 8
%11 = and i32 %10, 255
%12 = tail call i32 @Send_Byte(i32 %11)
%13 = and i32 %6, 255
%14 = tail call i32 @Send_Byte(i32 %13)
%15 = tail call i32 @Send_Byte(i32 255)
%16 = icmp eq i64 %1, 0
br i1 %16, label %28, label %17
17: ; preds = %3, %24
%18 = phi i64 [ %21, %24 ], [ 0, %3 ]
%19 = and i64 %18, 255
%20 = icmp eq i64 %19, 255
%21 = add nuw i64 %18, 1
br i1 %20, label %22, label %24
22: ; preds = %17
%23 = tail call i32 @printProgress(i64 %21, i64 %1)
br label %24
24: ; preds = %17, %22
%25 = tail call zeroext i8 (...) @Get_Byte()
%26 = getelementptr inbounds i8, i8* %2, i64 %18
store i8 %25, i8* %26
%27 = icmp eq i64 %21, %1
br i1 %27, label %28, label %17
28: ; preds = %24, %3
%29 = tail call i32 (...) @CE_High()
ret void
}