#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int hour, min, sec;
  printf("please input a time:\t HH:MM:SS\n");
  scanf("%d:%d:%d", &hour, &min, &sec);
  if (59 == sec) {
    sec = 0;
    if (59 == min) {
      min = 0;
      if (24 == hour)
        hour = 0;
      else
        hour = hour + 1;
    } else {
      min = min + 1;
    }
  } else {
    sec = sec + 1;
  }
  printf("the next second is:\n%02d:%02d:%02d\n", hour, min, sec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    $0x3b,%eax
cmp    -0x10(%rbp),%eax
jne    11b5 <main+0x95>
movl   $0x0,-0x10(%rbp)
mov    $0x3b,%eax
cmp    -0xc(%rbp),%eax
jne    11a7 <main+0x87>
movl   $0x0,-0xc(%rbp)
mov    $0x18,%eax
cmp    -0x8(%rbp),%eax
jne    1199 <main+0x79>
movl   $0x0,-0x8(%rbp)
jmp    11a2 <main+0x82>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <main+0x90>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x9e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%ecx
cmp    $0x3b,%ecx
jne    1190 <main+0x60>
movl   $0x0,0x14(%rsp)
mov    0xc(%rsp),%edx
cmp    $0x3b,%edx
jne    119d <main+0x6d>
movl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%eax
cmp    $0x18,%eax
jne    11a8 <main+0x78>
movl   $0x0,0x10(%rsp)
jmp    11af <main+0x7f>
add    $0x1,%ecx
mov    %ecx,0x14(%rsp)
mov    0xc(%rsp),%edx
jmp    11b3 <main+0x83>
add    $0x1,%edx
mov    %edx,0xc(%rsp)
xor    %ecx,%ecx
jmp    11b3 <main+0x83>
add    $0x1,%eax
mov    %eax,0x10(%rsp)
xor    %ecx,%ecx
xor    %edx,%edx
mov    0x10(%rsp),%esi
lea    0xe4b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"please input a time:\09 HH:MM:SS\0A\00"
@.str.1 = [9 x i8] c"%d:%d:%d\00"
@.str.2 = [36 x i8] c"the next second is:\0A%02d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %4
%8 = icmp eq i32 59, %7
br i1 %8, label %9, label %24
9: ; preds = %0
store i32 0, i32* %4
%10 = load i32, i32* %3
%11 = icmp eq i32 59, %10
br i1 %11, label %12, label %20
12: ; preds = %9
store i32 0, i32* %3
%13 = load i32, i32* %2
%14 = icmp eq i32 24, %13
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 0, i32* %2
br label %19
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %15
br label %23
20: ; preds = %9
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %20, %19
br label %27
24: ; preds = %0
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %27
27: ; preds = %24, %23
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d:%d:%d\00"
@.str.2 = [36 x i8] c"the next second is:\0A%02d:%02d:%02d\0A\00"
@str = [31 x i8] c"please input a time:\09 HH:MM:SS\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 59
br i1 %10, label %11, label %22
11: ; preds = %0
store i32 0, i32* %3
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 59
br i1 %13, label %14, label %20
14: ; preds = %11
store i32 0, i32* %2
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 24
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 0, i32* %1
br label %25
18: ; preds = %14
%19 = add nsw i32 %15, 1
store i32 %19, i32* %1
br label %25
20: ; preds = %11
%21 = add nsw i32 %12, 1
store i32 %21, i32* %2
br label %25
22: ; preds = %0
%23 = add nsw i32 %9, 1
store i32 %23, i32* %3
%24 = load i32, i32* %2
br label %25
25: ; preds = %20, %18, %17, %22
%26 = phi i32 [ 0, %20 ], [ 0, %18 ], [ 0, %17 ], [ %23, %22 ]
%27 = phi i32 [ %21, %20 ], [ 0, %18 ], [ 0, %17 ], [ %24, %22 ]
%28 = load i32, i32* %1
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %27, i32 %26)
ret i32 0
}