#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 */
struct rtc_time {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ RTC_AIE_OFF;
int /*<<< orphan*/ RTC_AIE_ON;
int /*<<< orphan*/ RTC_ALM_READ;
int /*<<< orphan*/ RTC_ALM_SET;
int /*<<< orphan*/ RTC_RD_TIME;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int ioctl(int, int /*<<< orphan*/, struct rtc_time *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, unsigned long *, int);
int /*<<< orphan*/ stderr;
void setup_alarm(int fd, int sec, void (*func)()) {
  int i, retval;
  unsigned long tmp, data;
  struct rtc_time rtc_tm;
  int scale_type = 1;
  retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);
  if (retval < 0) {
    printf("ioctl RTC_RD_TIME  faild!!!");
    return;
  }
  printf("read current time is: %04d-%02d-%02d %02d:%02d:%02d\n\n",
         rtc_tm.tm_year + 1900, rtc_tm.tm_mon + 1, rtc_tm.tm_mday,
         rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
  rtc_tm.tm_sec = rtc_tm.tm_sec + sec;
  if (rtc_tm.tm_sec > 60) {
    rtc_tm.tm_sec = rtc_tm.tm_sec - 60;
    rtc_tm.tm_min = rtc_tm.tm_min + 1;
  }
  retval = ioctl(fd, RTC_ALM_SET, &rtc_tm);
  if (retval < 0) {
    printf("ioctl RTC_ALM_SET  faild!!!\n");
    return;
  }
  retval = ioctl(fd, RTC_ALM_READ, &rtc_tm);
  if (retval < 0) {
    printf("ioctl  RTC_ALM_READ faild!!!\n");
    return;
  }
  printf("read current alarm time is: %04d-%02d-%02d %02d:%02d:%02d\n\n",
         rtc_tm.tm_year + 1900, rtc_tm.tm_mon + 1, rtc_tm.tm_mday,
         rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
  retval = ioctl(fd, RTC_AIE_ON, 0);
  if (retval < 0) {
    printf("ioctl  RTC_AIE_ON faild!!!\n");
    return;
  }
  fprintf(stderr, "Waiting %d seconds for alarm...\n\n", sec);
  fflush(stderr);
  retval = read(fd, &data, sizeof(unsigned long));
  if (retval > 0) {
    func();
  } else {
    printf("!!!alarm faild!!!\n");
    return;
  }
  retval = ioctl(fd, RTC_AIE_OFF, 0);
  if (retval == -1) {
    printf("ioctl RTC_AIE_OFF faild!!!\n");
    return;
  }
  printf("Test second alarm(hour,min,sec) test OK!\n");
}


x86 assembly (clang, -O0):
<setup_alarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e3d(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    119e <setup_alarm+0x4e>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1362 <setup_alarm+0x212>
mov    -0x40(%rbp),%esi
add    $0x76c,%esi
mov    -0x3c(%rbp),%edx
add    $0x1,%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x2c(%rbp),%eax
lea    0xe5a(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x3c,-0x2c(%rbp)
jle    11f1 <setup_alarm+0xa1>
mov    -0x2c(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1226 <setup_alarm+0xd6>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1362 <setup_alarm+0x212>
mov    -0x4(%rbp),%edi
mov    0x2da0(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    125b <setup_alarm+0x10b>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1362 <setup_alarm+0x212>
mov    -0x40(%rbp),%esi
add    $0x76c,%esi
mov    -0x3c(%rbp),%edx
add    $0x1,%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x2c(%rbp),%eax
lea    0xe0e(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12be <setup_alarm+0x16e>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1362 <setup_alarm+0x212>
mov    0x2d13(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe14(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x8,%edx
call   1050 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    130c <setup_alarm+0x1bc>
mov    $0x0,%al
call   *-0x10(%rbp)
jmp    131f <setup_alarm+0x1cf>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1362 <setup_alarm+0x212>
mov    -0x4(%rbp),%edi
mov    0x2c9f(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1354 <setup_alarm+0x204>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1362 <setup_alarm+0x212>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_alarm>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
mov    0x2e38(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
call   1050 <ioctl@plt>
test   %eax,%eax
js     12b7 <setup_alarm+0x157>
mov    $0x76c,%esi
add    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
add    $0x1,%edx
mov    0x14(%rsp),%r8d
mov    0x18(%rsp),%r9d
mov    0x1c(%rsp),%eax
mov    %eax,(%rsp)
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%eax
add    %ebp,%eax
mov    %eax,0x1c(%rsp)
cmp    $0x3d,%eax
jl     11da <setup_alarm+0x7a>
add    $0xffffffc4,%eax
mov    %eax,0x1c(%rsp)
addl   $0x1,0x18(%rsp)
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1050 <ioctl@plt>
test   %eax,%eax
js     12c7 <setup_alarm+0x167>
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1050 <ioctl@plt>
test   %eax,%eax
js     12d0 <setup_alarm+0x170>
mov    $0x76c,%esi
add    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
add    $0x1,%edx
mov    0x14(%rsp),%r8d
mov    0x18(%rsp),%r9d
mov    0x1c(%rsp),%eax
mov    %eax,(%rsp)
lea    0xe12(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d6a(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1050 <ioctl@plt>
test   %eax,%eax
js     12d9 <setup_alarm+0x179>
mov    0x2d74(%rip),%r15
mov    (%r15),%edi
lea    0xe20(%rip),%rsi
mov    %ebp,%edx
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1080 <fflush@plt>
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    12e2 <setup_alarm+0x182>
xor    %eax,%eax
call   *%r14
mov    0x2d2a(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
je     12eb <setup_alarm+0x18b>
lea    0xe0d(%rip),%rdi
jmp    12f2 <setup_alarm+0x192>
lea    0xd42(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12f7 <setup_alarm+0x197>
lea    0xe70(%rip),%rdi
jmp    12f2 <setup_alarm+0x192>
lea    0xe4a(%rip),%rdi
jmp    12f2 <setup_alarm+0x192>
lea    0xe26(%rip),%rdi
jmp    12f2 <setup_alarm+0x192>
lea    0xdc7(%rip),%rdi
jmp    12f2 <setup_alarm+0x192>
lea    0xdf9(%rip),%rdi
call   1030 <puts@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rtc_time = type { i32, i32, i32, i32, i32, i32 }
@RTC_RD_TIME = global i32 0
@.str = [28 x i8] c"ioctl RTC_RD_TIME faild!!!\00"
@.str.1 = [54 x i8] c"read current time is: %04d-%02d-%02d %02d:%02d:%02d\0A\0A\00"
@RTC_ALM_SET = global i32 0
@.str.2 = [29 x i8] c"ioctl RTC_ALM_SET faild!!!\0A\00"
@RTC_ALM_READ = global i32 0
@.str.3 = [30 x i8] c"ioctl RTC_ALM_READ faild!!!\0A\00"
@.str.4 = [60 x i8] c"read current alarm time is: %04d-%02d-%02d %02d:%02d:%02d\0A\0A\00"
@RTC_AIE_ON = global i32 0
@.str.5 = [28 x i8] c"ioctl RTC_AIE_ON faild!!!\0A\00"
@stderr = global i32 0
@.str.6 = [34 x i8] c"Waiting %d seconds for alarm...\0A\0A\00"
@.str.7 = [19 x i8] c"!!!alarm faild!!!\0A\00"
@RTC_AIE_OFF = global i32 0
@.str.8 = [28 x i8] c"ioctl RTC_AIE_OFF faild!!!\0A\00"
@.str.9 = [42 x i8] c"Test second alarm(hour,min,sec) test OK!\0A\00"
define void @setup_alarm(i32 %0, i32 %1, void (...)* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca void (...)*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca %struct.rtc_time
%12 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store void (...)* %2, void (...)** %6
store i32 1, i32* %12
%13 = load i32, i32* %4
%14 = load i32, i32* @RTC_RD_TIME
%15 = call i32 @ioctl(i32 %13, i32 %14, %struct.rtc_time* %11)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %116
20: ; preds = %3
%21 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 0
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1900
%24 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 1
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
%27 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 2
%28 = load i32, i32* %27
%29 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 3
%30 = load i32, i32* %29
%31 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 4
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %26, i32 %28, i32 %30, i32 %32, i32 %34)
%36 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
%37 = load i32, i32* %36
%38 = load i32, i32* %5
%39 = add nsw i32 %37, %38
%40 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
store i32 %39, i32* %40
%41 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
%42 = load i32, i32* %41
%43 = icmp sgt i32 %42, 60
br i1 %43, label %44, label %53
44: ; preds = %20
%45 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
%46 = load i32, i32* %45
%47 = sub nsw i32 %46, 60
%48 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
store i32 %47, i32* %48
%49 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 4
%50 = load i32, i32* %49
%51 = add nsw i32 %50, 1
%52 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 4
store i32 %51, i32* %52
br label %53
53: ; preds = %44, %20
%54 = load i32, i32* %4
%55 = load i32, i32* @RTC_ALM_SET
%56 = call i32 @ioctl(i32 %54, i32 %55, %struct.rtc_time* %11)
store i32 %56, i32* %8
%57 = load i32, i32* %8
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %116
61: ; preds = %53
%62 = load i32, i32* %4
%63 = load i32, i32* @RTC_ALM_READ
%64 = call i32 @ioctl(i32 %62, i32 %63, %struct.rtc_time* %11)
store i32 %64, i32* %8
%65 = load i32, i32* %8
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %61
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %116
69: ; preds = %61
%70 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 0
%71 = load i32, i32* %70
%72 = add nsw i32 %71, 1900
%73 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 1
%74 = load i32, i32* %73
%75 = add nsw i32 %74, 1
%76 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 2
%77 = load i32, i32* %76
%78 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 3
%79 = load i32, i32* %78
%80 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 4
%81 = load i32, i32* %80
%82 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %11, i32 0, i32 5
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0), i32 %72, i32 %75, i32 %77, i32 %79, i32 %81, i32 %83)
%85 = load i32, i32* %4
%86 = load i32, i32* @RTC_AIE_ON
%87 = call i32 @ioctl(i32 %85, i32 %86, %struct.rtc_time* null)
store i32 %87, i32* %8
%88 = load i32, i32* %8
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %69
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %116
92: ; preds = %69
%93 = load i32, i32* @stderr
%94 = load i32, i32* %5
%95 = call i32 @fprintf(i32 %93, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 %94)
%96 = load i32, i32* @stderr
%97 = call i32 @fflush(i32 %96)
%98 = load i32, i32* %4
%99 = call i32 @read(i32 %98, i64* %10, i32 8)
store i32 %99, i32* %8
%100 = load i32, i32* %8
%101 = icmp sgt i32 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %92
%103 = load void (...)*, void (...)** %6
br label %106
104: ; preds = %92
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %116
106: ; preds = %102
%107 = load i32, i32* %4
%108 = load i32, i32* @RTC_AIE_OFF
%109 = call i32 @ioctl(i32 %107, i32 %108, %struct.rtc_time* null)
store i32 %109, i32* %8
%110 = load i32, i32* %8
%111 = icmp eq i32 %110, -1
br i1 %111, label %112, label %114
112: ; preds = %106
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %116
114: ; preds = %106
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
br label %116
116: ; preds = %114, %112, %104, %90, %67, %59, %18
ret void
}

LLVM IR (-O2):
%struct.rtc_time = type { i32, i32, i32, i32, i32, i32 }
@RTC_RD_TIME = global i32 0
@.str = [28 x i8] c"ioctl RTC_RD_TIME faild!!!\00"
@.str.1 = [54 x i8] c"read current time is: %04d-%02d-%02d %02d:%02d:%02d\0A\0A\00"
@RTC_ALM_SET = global i32 0
@RTC_ALM_READ = global i32 0
@.str.4 = [60 x i8] c"read current alarm time is: %04d-%02d-%02d %02d:%02d:%02d\0A\0A\00"
@RTC_AIE_ON = global i32 0
@stderr = global i32 0
@.str.6 = [34 x i8] c"Waiting %d seconds for alarm...\0A\0A\00"
@RTC_AIE_OFF = global i32 0
@str = [18 x i8] c"!!!alarm faild!!!\00"
@str.10 = [41 x i8] c"Test second alarm(hour,min,sec) test OK!\00"
@str.11 = [27 x i8] c"ioctl RTC_AIE_OFF faild!!!\00"
@str.12 = [27 x i8] c"ioctl RTC_AIE_ON faild!!!\00"
@str.13 = [29 x i8] c"ioctl RTC_ALM_READ faild!!!\00"
@str.14 = [28 x i8] c"ioctl RTC_ALM_SET faild!!!\00"
define void @setup_alarm(i32 %0, i32 %1, void (...)* nocapture %2) {
%4 = alloca i64
%5 = alloca %struct.rtc_time
%6 = bitcast i64* %4 to i8*
%7 = bitcast %struct.rtc_time* %5 to i8*
%8 = load i32, i32* @RTC_RD_TIME
%9 = call i32 @ioctl(i32 %0, i32 %8, %struct.rtc_time* %5)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %80
13: ; preds = %3
%14 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %5, i64 0, i32 0
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1900
%17 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %5, i64 0, i32 1
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
%20 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %5, i64 0, i32 2
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %5, i64 0, i32 3
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %5, i64 0, i32 4
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.rtc_time, %struct.rtc_time* %5, i64 0, i32 5
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %19, i32 %21, i32 %23, i32 %25, i32 %27)
%29 = load i32, i32* %26
%30 = add nsw i32 %29, %1
store i32 %30, i32* %26
%31 = icmp sgt i32 %30, 60
br i1 %31, label %32, label %36
32: ; preds = %13
%33 = add nsw i32 %30, -60
store i32 %33, i32* %26
%34 = load i32, i32* %24
%35 = add nsw i32 %34, 1
store i32 %35, i32* %24
br label %36
36: ; preds = %32, %13
%37 = load i32, i32* @RTC_ALM_SET
%38 = call i32 @ioctl(i32 %0, i32 %37, %struct.rtc_time* %5)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
br label %80
42: ; preds = %36
%43 = load i32, i32* @RTC_ALM_READ
%44 = call i32 @ioctl(i32 %0, i32 %43, %struct.rtc_time* %5)
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.13, i64 0, i64 0))
br label %80
48: ; preds = %42
%49 = load i32, i32* %14
%50 = add nsw i32 %49, 1900
%51 = load i32, i32* %17
%52 = add nsw i32 %51, 1
%53 = load i32, i32* %20
%54 = load i32, i32* %22
%55 = load i32, i32* %24
%56 = load i32, i32* %26
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0), i32 %50, i32 %52, i32 %53, i32 %54, i32 %55, i32 %56)
%58 = load i32, i32* @RTC_AIE_ON
%59 = call i32 @ioctl(i32 %0, i32 %58, %struct.rtc_time* null)
%60 = icmp slt i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %48
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
br label %80
63: ; preds = %48
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 %1)
%66 = load i32, i32* @stderr
%67 = call i32 @fflush(i32 %66)
%68 = call i32 @read(i32 %0, i64* %4, i32 8)
%69 = icmp sgt i32 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %63
%71 = load i32, i32* @RTC_AIE_OFF
%72 = call i32 @ioctl(i32 %0, i32 %71, %struct.rtc_time* null)
%73 = icmp eq i32 %72, -1
br i1 %73, label %76, label %78
74: ; preds = %63
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %80
76: ; preds = %70
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
br label %80
78: ; preds = %70
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.10, i64 0, i64 0))
br label %80
80: ; preds = %78, %76, %74, %61, %46, %40, %11
ret void
}