#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*/ I2C1_Start();
int /*<<< orphan*/ I2C1_Stop();
int /*<<< orphan*/ I2C1_Wr(int);
void RTC_Write_RAM(char *values, int size) {
  int i;
  I2C1_Start();
  I2C1_Wr(0xD0);
  I2C1_Wr(8);
  for (i = 0; i < size; i++)
    I2C1_Wr(*values++);
  I2C1_Stop();
}


x86 assembly (clang, -O0):
<RTC_Write_RAM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1050 <I2C1_Start@plt>
mov    $0xd0,%edi
call   1040 <I2C1_Wr@plt>
mov    $0x8,%edi
call   1040 <I2C1_Wr@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1192 <RTC_Write_RAM+0x62>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1040 <I2C1_Wr@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1161 <RTC_Write_RAM+0x31>
mov    $0x0,%al
call   1030 <I2C1_Stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTC_Write_RAM>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <I2C1_Start@plt>
mov    $0xd0,%edi
call   1040 <I2C1_Wr@plt>
mov    $0x8,%edi
call   1040 <I2C1_Wr@plt>
test   %ebp,%ebp
jle    1172 <RTC_Write_RAM+0x42>
mov    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1040 <I2C1_Wr@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1160 <RTC_Write_RAM+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <I2C1_Stop@plt>

LLVM IR (-O0):
define void @RTC_Write_RAM(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 (...) @I2C1_Start()
%7 = call i32 @I2C1_Wr(i32 208)
%8 = call i32 @I2C1_Wr(i32 8)
store i32 0, i32* %5
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = call i32 @I2C1_Wr(i32 %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = call i32 (...) @I2C1_Stop()
ret void
}

LLVM IR (-O2):
define void @RTC_Write_RAM(i8* nocapture %0, i32 %1) {
%3 = tail call i32 (...) @I2C1_Start()
%4 = tail call i32 @I2C1_Wr(i32 208)
%5 = tail call i32 @I2C1_Wr(i32 8)
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %16
7: ; preds = %2, %7
%8 = phi i32 [ %14, %7 ], [ 0, %2 ]
%9 = phi i8* [ %10, %7 ], [ %0, %2 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = tail call i32 @I2C1_Wr(i32 %12)
%14 = add nuw nsw i32 %8, 1
%15 = icmp eq i32 %14, %1
br i1 %15, label %16, label %7
16: ; preds = %7, %2
%17 = tail call i32 (...) @I2C1_Stop()
ret void
}