#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*/ DelayXms(int);
int /*<<< orphan*/ I2C_WriteByte(int, unsigned char, unsigned char *);
void AT24C02_WriteBytes(unsigned char regAddr, unsigned char *byte,
                        unsigned char len) {
  unsigned char count = 0;
  for (; count < len; count++) {
    I2C_WriteByte(0x50, regAddr, byte);
    regAddr++;
    byte++;
    DelayXms(5);
  }
}


x86 assembly (clang, -O0):
<AT24C02_WriteBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    118a <AT24C02_WriteBytes+0x6a>
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    $0x50,%edi
movzbl %al,%esi
call   1040 <I2C_WriteByte@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    $0x5,%edi
call   1030 <DelayXms@plt>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    113b <AT24C02_WriteBytes+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT24C02_WriteBytes>:
push   %rbp
push   %r14
push   %rbx
test   %edx,%edx
je     115b <AT24C02_WriteBytes+0x3b>
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
movzbl %bpl,%ebp
mov    $0x50,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1040 <I2C_WriteByte@plt>
add    $0x1,%bpl
add    $0x1,%rbx
mov    $0x5,%edi
call   1030 <DelayXms@plt>
add    $0xff,%r14b
jne    1130 <AT24C02_WriteBytes+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @AT24C02_WriteBytes(i8 zeroext %0, i8* %1, i8 zeroext %2) {
%4 = icmp eq i8 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %5
%6 = phi i8 [ %13, %5 ], [ 0, %3 ]
%7 = phi i8 [ %10, %5 ], [ %0, %3 ]
%8 = phi i8* [ %11, %5 ], [ %1, %3 ]
%9 = tail call i32 @I2C_WriteByte(i32 80, i8 zeroext %7, i8* %8)
%10 = add i8 %7, 1
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = tail call i32 @DelayXms(i32 5)
%13 = add nuw i8 %6, 1
%14 = icmp eq i8 %13, %2
br i1 %14, label %15, label %5
15: ; preds = %5, %3
ret void
}