#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 tm {
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main(int argc, char const *argv[]) {
  char *date = "01/27 24:30";
  struct tm tm;
  scanf("%d/%d %d:%d", &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min);
  while (tm.tm_hour > 23) {
    tm.tm_hour = tm.tm_hour - 24;
    tm.tm_mday++;
  }
  printf("%02d/%02d %02d:%02d\n", tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x28(%rbp),%rsi
lea    -0x28(%rbp),%rdx
add    $0x4,%rdx
lea    -0x28(%rbp),%rcx
add    $0x8,%rcx
lea    -0x28(%rbp),%r8
add    $0xc,%r8
lea    0xea8(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x17,-0x20(%rbp)
jle    118a <main+0x6a>
mov    -0x20(%rbp),%eax
sub    $0x18,%eax
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1169 <main+0x49>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0xec6(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
cmp    $0x18,%ecx
jl     118e <main+0x6e>
cmp    $0x2f,%ecx
mov    $0x2f,%eax
cmovl  %ecx,%eax
neg    %eax
add    %ecx,%eax
add    $0x17,%eax
mov    $0xaaaaaaab,%esi
imul   %rax,%rsi
shr    $0x24,%rsi
lea    0x0(,%rsi,8),%eax
lea    (%rax,%rax,2),%eax
neg    %eax
add    %eax,%ecx
add    $0xffffffe8,%ecx
add    %esi,%edx
add    $0x1,%edx
mov    %ecx,0x10(%rsp)
mov    %edx,0xc(%rsp)
mov    0x8(%rsp),%esi
mov    0x14(%rsp),%r8d
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32 }
@.str = [12 x i8] c"01/27 24:30\00"
@.str.1 = [12 x i8] c"%d/%d %d:%d\00"
@.str.2 = [21 x i8] c"%02d/%02d %02d:%02d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca %struct.tm
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %6
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%10 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 3
%12 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %8, i32* %9, i32* %10, i32* %11)
br label %13
13: ; preds = %17, %2
%14 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 23
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%19 = load i32, i32* %18
%20 = sub nsw i32 %19, 24
%21 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
store i32 %20, i32* %21
%22 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
br label %13
25: ; preds = %13
%26 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 3
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %29, i32 %31, i32 %33)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32 }
@.str.1 = [12 x i8] c"%d/%d %d:%d\00"
@.str.2 = [21 x i8] c"%02d/%02d %02d:%02d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.tm
%4 = bitcast %struct.tm* %3 to i8*
%5 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%6 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%7 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%8 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8)
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp sgt i32 %10, 23
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = add nuw i32 %10, 23
%15 = call i32 @llvm.smin.i32(i32 %10, i32 47)
%16 = sub nuw i32 %14, %15
%17 = udiv i32 %16, 24
%18 = mul nsw i32 %17, -24
%19 = add i32 %11, %17
%20 = add nsw i32 %10, -24
%21 = add nsw i32 %18, %20
%22 = add i32 %19, 1
store i32 %21, i32* %7
store i32 %22, i32* %6
br label %23
23: ; preds = %13, %2
%24 = phi i32 [ %22, %13 ], [ %11, %2 ]
%25 = phi i32 [ %21, %13 ], [ %10, %2 ]
%26 = load i32, i32* %5
%27 = load i32, i32* %8
%28 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %24, i32 %25, i32 %27)
ret i32 0
}