#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*/ DS1302(int, int);
int /*<<< orphan*/ Idle_1302();
void Enable_1302(void) {
  unsigned char Cmd_Byte;
  unsigned char databyte;
  unsigned char shifter;
  unsigned int i, j;
  DS1302(1, 0);
  DS1302(4, 0);
  DS1302(2, 1);
  Cmd_Byte = 0x8e;
  shifter = 0x01;
  for (i = 0; i < 8; i++) {
    if (shifter & Cmd_Byte)
      DS1302(4, 1);
    else
      DS1302(4, 0);
    DS1302(1, 1);
    shifter = shifter << 1;
    DS1302(1, 0);
  }
  shifter = 0x01;
  databyte = 0;
  for (j = 0; j < 8; j++) {
    if (shifter & databyte)
      DS1302(4, 1);
    else
      DS1302(4, 0);
    DS1302(1, 1);
    shifter = shifter << 1;
    DS1302(1, 0);
  }
  Idle_1302();
  return;
}


x86 assembly (clang, -O0):
<Enable_1302>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
movb   $0x8e,-0x1(%rbp)
movb   $0x1,-0x3(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jae    11cb <Enable_1302+0xab>
movzbl -0x3(%rbp),%eax
movzbl -0x1(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     118f <Enable_1302+0x6f>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
jmp    119b <Enable_1302+0x7b>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <DS1302@plt>
movzbl -0x3(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x3(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <Enable_1302+0x3e>
movb   $0x1,-0x3(%rbp)
movb   $0x0,-0x2(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jae    1247 <Enable_1302+0x127>
movzbl -0x3(%rbp),%eax
movzbl -0x2(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     120b <Enable_1302+0xeb>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
jmp    1217 <Enable_1302+0xf7>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <DS1302@plt>
movzbl -0x3(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x3(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11da <Enable_1302+0xba>
mov    $0x0,%al
call   1030 <Idle_1302@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Enable_1302>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <DS1302@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <DS1302@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <Idle_1302@plt>

LLVM IR (-O0):
define void @Enable_1302() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @DS1302(i32 1, i32 0)
%7 = call i32 @DS1302(i32 4, i32 0)
%8 = call i32 @DS1302(i32 2, i32 1)
store i8 -114, i8* %1
store i8 1, i8* %3
store i32 0, i32* %4
br label %9
9: ; preds = %30, %0
%10 = load i32, i32* %4
%11 = icmp ult i32 %10, 8
br i1 %11, label %12, label %33
12: ; preds = %9
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = load i8, i8* %1
%16 = zext i8 %15 to i32
%17 = and i32 %14, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 @DS1302(i32 4, i32 1)
br label %23
21: ; preds = %12
%22 = call i32 @DS1302(i32 4, i32 0)
br label %23
23: ; preds = %21, %19
%24 = call i32 @DS1302(i32 1, i32 1)
%25 = load i8, i8* %3
%26 = zext i8 %25 to i32
%27 = shl i32 %26, 1
%28 = trunc i32 %27 to i8
store i8 %28, i8* %3
%29 = call i32 @DS1302(i32 1, i32 0)
br label %30
30: ; preds = %23
%31 = load i32, i32* %4
%32 = add i32 %31, 1
store i32 %32, i32* %4
br label %9
33: ; preds = %9
store i8 1, i8* %3
store i8 0, i8* %2
store i32 0, i32* %5
br label %34
34: ; preds = %55, %33
%35 = load i32, i32* %5
%36 = icmp ult i32 %35, 8
br i1 %36, label %37, label %58
37: ; preds = %34
%38 = load i8, i8* %3
%39 = zext i8 %38 to i32
%40 = load i8, i8* %2
%41 = zext i8 %40 to i32
%42 = and i32 %39, %41
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %37
%45 = call i32 @DS1302(i32 4, i32 1)
br label %48
46: ; preds = %37
%47 = call i32 @DS1302(i32 4, i32 0)
br label %48
48: ; preds = %46, %44
%49 = call i32 @DS1302(i32 1, i32 1)
%50 = load i8, i8* %3
%51 = zext i8 %50 to i32
%52 = shl i32 %51, 1
%53 = trunc i32 %52 to i8
store i8 %53, i8* %3
%54 = call i32 @DS1302(i32 1, i32 0)
br label %55
55: ; preds = %48
%56 = load i32, i32* %5
%57 = add i32 %56, 1
store i32 %57, i32* %5
br label %34
58: ; preds = %34
%59 = call i32 (...) @Idle_1302()
ret void
}

LLVM IR (-O2):
define void @Enable_1302() {
%1 = tail call i32 @DS1302(i32 1, i32 0)
%2 = tail call i32 @DS1302(i32 4, i32 0)
%3 = tail call i32 @DS1302(i32 2, i32 1)
%4 = tail call i32 @DS1302(i32 4, i32 0)
%5 = tail call i32 @DS1302(i32 1, i32 1)
%6 = tail call i32 @DS1302(i32 1, i32 0)
%7 = tail call i32 @DS1302(i32 4, i32 1)
%8 = tail call i32 @DS1302(i32 1, i32 1)
%9 = tail call i32 @DS1302(i32 1, i32 0)
%10 = tail call i32 @DS1302(i32 4, i32 1)
%11 = tail call i32 @DS1302(i32 1, i32 1)
%12 = tail call i32 @DS1302(i32 1, i32 0)
%13 = tail call i32 @DS1302(i32 4, i32 1)
%14 = tail call i32 @DS1302(i32 1, i32 1)
%15 = tail call i32 @DS1302(i32 1, i32 0)
%16 = tail call i32 @DS1302(i32 4, i32 0)
%17 = tail call i32 @DS1302(i32 1, i32 1)
%18 = tail call i32 @DS1302(i32 1, i32 0)
%19 = tail call i32 @DS1302(i32 4, i32 0)
%20 = tail call i32 @DS1302(i32 1, i32 1)
%21 = tail call i32 @DS1302(i32 1, i32 0)
%22 = tail call i32 @DS1302(i32 4, i32 0)
%23 = tail call i32 @DS1302(i32 1, i32 1)
%24 = tail call i32 @DS1302(i32 1, i32 0)
%25 = tail call i32 @DS1302(i32 4, i32 1)
%26 = tail call i32 @DS1302(i32 1, i32 1)
%27 = tail call i32 @DS1302(i32 1, i32 0)
%28 = tail call i32 @DS1302(i32 4, i32 0)
%29 = tail call i32 @DS1302(i32 1, i32 1)
%30 = tail call i32 @DS1302(i32 1, i32 0)
%31 = tail call i32 @DS1302(i32 4, i32 0)
%32 = tail call i32 @DS1302(i32 1, i32 1)
%33 = tail call i32 @DS1302(i32 1, i32 0)
%34 = tail call i32 @DS1302(i32 4, i32 0)
%35 = tail call i32 @DS1302(i32 1, i32 1)
%36 = tail call i32 @DS1302(i32 1, i32 0)
%37 = tail call i32 @DS1302(i32 4, i32 0)
%38 = tail call i32 @DS1302(i32 1, i32 1)
%39 = tail call i32 @DS1302(i32 1, i32 0)
%40 = tail call i32 @DS1302(i32 4, i32 0)
%41 = tail call i32 @DS1302(i32 1, i32 1)
%42 = tail call i32 @DS1302(i32 1, i32 0)
%43 = tail call i32 @DS1302(i32 4, i32 0)
%44 = tail call i32 @DS1302(i32 1, i32 1)
%45 = tail call i32 @DS1302(i32 1, i32 0)
%46 = tail call i32 @DS1302(i32 4, i32 0)
%47 = tail call i32 @DS1302(i32 1, i32 1)
%48 = tail call i32 @DS1302(i32 1, i32 0)
%49 = tail call i32 @DS1302(i32 4, i32 0)
%50 = tail call i32 @DS1302(i32 1, i32 1)
%51 = tail call i32 @DS1302(i32 1, i32 0)
%52 = tail call i32 (...) @Idle_1302()
ret void
}