#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 */
unsigned char ADS1299ReadReg(unsigned char);
void ADS1299ReadAllReg(unsigned char *registers) {
  unsigned char iReg;
  for (iReg = 0; iReg < 25; iReg++) {
    registers[iReg] = ADS1299ReadReg(iReg);
  }
}


x86 assembly (clang, -O0):
<ADS1299ReadAllReg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x19,%eax
jge    1150 <ADS1299ReadAllReg+0x40>
movzbl -0x9(%rbp),%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1120 <ADS1299ReadAllReg+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADS1299ReadAllReg>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,(%rbx)
mov    $0x1,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x1(%rbx)
mov    $0x2,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x2(%rbx)
mov    $0x3,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x3(%rbx)
mov    $0x4,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x4(%rbx)
mov    $0x5,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x5(%rbx)
mov    $0x6,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x6(%rbx)
mov    $0x7,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x7(%rbx)
mov    $0x8,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x8(%rbx)
mov    $0x9,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x9(%rbx)
mov    $0xa,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0xa(%rbx)
mov    $0xb,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0xb(%rbx)
mov    $0xc,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0xc(%rbx)
mov    $0xd,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0xd(%rbx)
mov    $0xe,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0xe(%rbx)
mov    $0xf,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0xf(%rbx)
mov    $0x10,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x10(%rbx)
mov    $0x11,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x11(%rbx)
mov    $0x12,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x12(%rbx)
mov    $0x13,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x13(%rbx)
mov    $0x14,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x14(%rbx)
mov    $0x15,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x15(%rbx)
mov    $0x16,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x16(%rbx)
mov    $0x17,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x17(%rbx)
mov    $0x18,%edi
call   1030 <ADS1299ReadReg@plt>
mov    %al,0x18(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @ADS1299ReadAllReg(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %3
br label %4
4: ; preds = %15, %1
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 25
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i8, i8* %3
%10 = call zeroext i8 @ADS1299ReadReg(i8 zeroext %9)
%11 = load i8*, i8** %2
%12 = load i8, i8* %3
%13 = zext i8 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 %10, i8* %14
br label %15
15: ; preds = %8
%16 = load i8, i8* %3
%17 = add i8 %16, 1
store i8 %17, i8* %3
br label %4
18: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @ADS1299ReadAllReg(i8* nocapture writeonly %0) {
%2 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 0)
store i8 %2, i8* %0
%3 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 1)
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %4
%5 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 2)
%6 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %5, i8* %6
%7 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 3)
%8 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %7, i8* %8
%9 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 4)
%10 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %9, i8* %10
%11 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 5)
%12 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %11, i8* %12
%13 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 6)
%14 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %13, i8* %14
%15 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 7)
%16 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %15, i8* %16
%17 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 8)
%18 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %17, i8* %18
%19 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 9)
%20 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %19, i8* %20
%21 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 10)
%22 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %21, i8* %22
%23 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 11)
%24 = getelementptr inbounds i8, i8* %0, i64 11
store i8 %23, i8* %24
%25 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 12)
%26 = getelementptr inbounds i8, i8* %0, i64 12
store i8 %25, i8* %26
%27 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 13)
%28 = getelementptr inbounds i8, i8* %0, i64 13
store i8 %27, i8* %28
%29 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 14)
%30 = getelementptr inbounds i8, i8* %0, i64 14
store i8 %29, i8* %30
%31 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 15)
%32 = getelementptr inbounds i8, i8* %0, i64 15
store i8 %31, i8* %32
%33 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 16)
%34 = getelementptr inbounds i8, i8* %0, i64 16
store i8 %33, i8* %34
%35 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 17)
%36 = getelementptr inbounds i8, i8* %0, i64 17
store i8 %35, i8* %36
%37 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 18)
%38 = getelementptr inbounds i8, i8* %0, i64 18
store i8 %37, i8* %38
%39 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 19)
%40 = getelementptr inbounds i8, i8* %0, i64 19
store i8 %39, i8* %40
%41 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 20)
%42 = getelementptr inbounds i8, i8* %0, i64 20
store i8 %41, i8* %42
%43 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 21)
%44 = getelementptr inbounds i8, i8* %0, i64 21
store i8 %43, i8* %44
%45 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 22)
%46 = getelementptr inbounds i8, i8* %0, i64 22
store i8 %45, i8* %46
%47 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 23)
%48 = getelementptr inbounds i8, i8* %0, i64 23
store i8 %47, i8* %48
%49 = tail call zeroext i8 @ADS1299ReadReg(i8 zeroext 24)
%50 = getelementptr inbounds i8, i8* %0, i64 24
store i8 %49, i8* %50
ret void
}