#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*/ DS3231_Write(int, int /*<<< orphan*/);
int /*<<< orphan*/ decimal_to_bcd(unsigned char);
void setDate(unsigned char daySet, unsigned char dateSet,
             unsigned char monthSet, unsigned char yearSet) {
  DS3231_Write(0x03, (decimal_to_bcd(daySet)));
  DS3231_Write(0x04, (decimal_to_bcd(dateSet)));
  DS3231_Write(0x05, (decimal_to_bcd(monthSet)));
  DS3231_Write(0x06, (decimal_to_bcd(yearSet)));
}


x86 assembly (clang, -O0):
<setDate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %cl,-0x3(%rbp)
mov    %al,-0x4(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <decimal_to_bcd@plt>
mov    %eax,%esi
mov    $0x3,%edi
call   1040 <DS3231_Write@plt>
movzbl -0x2(%rbp),%edi
call   1030 <decimal_to_bcd@plt>
mov    %eax,%esi
mov    $0x4,%edi
call   1040 <DS3231_Write@plt>
movzbl -0x3(%rbp),%edi
call   1030 <decimal_to_bcd@plt>
mov    %eax,%esi
mov    $0x5,%edi
call   1040 <DS3231_Write@plt>
movzbl -0x4(%rbp),%edi
call   1030 <decimal_to_bcd@plt>
mov    %eax,%esi
mov    $0x6,%edi
call   1040 <DS3231_Write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setDate>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
call   1030 <decimal_to_bcd@plt>
mov    $0x3,%edi
mov    %eax,%esi
call   1040 <DS3231_Write@plt>
mov    %ebx,%edi
call   1030 <decimal_to_bcd@plt>
mov    $0x4,%edi
mov    %eax,%esi
call   1040 <DS3231_Write@plt>
mov    %ebp,%edi
call   1030 <decimal_to_bcd@plt>
mov    $0x5,%edi
mov    %eax,%esi
call   1040 <DS3231_Write@plt>
mov    %r14d,%edi
call   1030 <decimal_to_bcd@plt>
mov    $0x6,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <DS3231_Write@plt>

LLVM IR (-O0):
define void @setDate(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i8, i8* %5
%10 = call i32 @decimal_to_bcd(i8 zeroext %9)
%11 = call i32 @DS3231_Write(i32 3, i32 %10)
%12 = load i8, i8* %6
%13 = call i32 @decimal_to_bcd(i8 zeroext %12)
%14 = call i32 @DS3231_Write(i32 4, i32 %13)
%15 = load i8, i8* %7
%16 = call i32 @decimal_to_bcd(i8 zeroext %15)
%17 = call i32 @DS3231_Write(i32 5, i32 %16)
%18 = load i8, i8* %8
%19 = call i32 @decimal_to_bcd(i8 zeroext %18)
%20 = call i32 @DS3231_Write(i32 6, i32 %19)
ret void
}

LLVM IR (-O2):
define void @setDate(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = tail call i32 @decimal_to_bcd(i8 zeroext %0)
%6 = tail call i32 @DS3231_Write(i32 3, i32 %5)
%7 = tail call i32 @decimal_to_bcd(i8 zeroext %1)
%8 = tail call i32 @DS3231_Write(i32 4, i32 %7)
%9 = tail call i32 @decimal_to_bcd(i8 zeroext %2)
%10 = tail call i32 @DS3231_Write(i32 5, i32 %9)
%11 = tail call i32 @decimal_to_bcd(i8 zeroext %3)
%12 = tail call i32 @DS3231_Write(i32 6, i32 %11)
ret void
}