#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 scanf(char *, ...);
int main(void) {
  unsigned short H, M, S;
  int T;
  do {
    do {
      printf("Informação horária HH:MM:SS? ");
      T = scanf("%2hu:%2hu:%2hu", &H, &M, &S);
      scanf("%*[^\n]");
      scanf("%*c");
    } while (T != 3);
    printf("%d - %dh %dm %ds \n", T, H, M, S);
  } while ((H > 23) || (M > 59) || (S > 59));
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
jmp    1134 <main+0x14>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x6(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xa(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0x10(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x3,-0x10(%rbp)
jne    1134 <main+0x14>
mov    -0x10(%rbp),%esi
movzwl -0x6(%rbp),%edx
movzwl -0x8(%rbp),%ecx
movzwl -0xa(%rbp),%r8d
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzwl -0x6(%rbp),%ecx
mov    $0x1,%al
cmp    $0x17,%ecx
mov    %al,-0x11(%rbp)
jg     11d4 <main+0xb4>
movzwl -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3b,%ecx
mov    %al,-0x11(%rbp)
jg     11d4 <main+0xb4>
movzwl -0xa(%rbp),%eax
cmp    $0x3b,%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x6(%rsp),%r12
lea    0x4(%rsp),%r13
lea    0x2(%rsp),%rbx
lea    0xeef(%rip),%rbp
lea    0xeef(%rip),%r14
nopl   0x0(%rax,%rax,1)
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x3,%r15d
jne    1150 <main+0x30>
movzwl 0x6(%rsp),%edx
movzwl 0x4(%rsp),%ecx
movzwl 0x2(%rsp),%r8d
lea    0xe92(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpw   $0x17,0x6(%rsp)
ja     1150 <main+0x30>
cmpw   $0x3b,0x4(%rsp)
ja     1150 <main+0x30>
cmpw   $0x3b,0x2(%rsp)
ja     1150 <main+0x30>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Informa\C3\A7\C3\A3o hor\C3\A1ria HH:MM:SS? \00"
@.str.1 = [15 x i8] c"%2hu:%2hu:%2hu\00"
@.str.2 = [7 x i8] c"%*[^\0A]\00"
@.str.3 = [4 x i8] c"%*c\00"
@.str.4 = [19 x i8] c"%d - %dh %dm %ds \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %36, %0
br label %7
7: ; preds = %12, %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i16* %2, i16* %3, i16* %4)
store i32 %9, i32* %5
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %7
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 3
br i1 %14, label %7, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = load i16, i16* %2
%18 = zext i16 %17 to i32
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
%21 = load i16, i16* %4
%22 = zext i16 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %18, i32 %20, i32 %22)
br label %24
24: ; preds = %15
%25 = load i16, i16* %2
%26 = zext i16 %25 to i32
%27 = icmp sgt i32 %26, 23
br i1 %27, label %36, label %28
28: ; preds = %24
%29 = load i16, i16* %3
%30 = zext i16 %29 to i32
%31 = icmp sgt i32 %30, 59
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = load i16, i16* %4
%34 = zext i16 %33 to i32
%35 = icmp sgt i32 %34, 59
br label %36
36: ; preds = %32, %28, %24
%37 = phi i1 [ true, %28 ], [ true, %24 ], [ %35, %32 ]
br i1 %37, label %6, label %38
38: ; preds = %36
ret i32 1
}

LLVM IR (-O2):
@.str = [33 x i8] c"Informa\C3\A7\C3\A3o hor\C3\A1ria HH:MM:SS? \00"
@.str.1 = [15 x i8] c"%2hu:%2hu:%2hu\00"
@.str.2 = [7 x i8] c"%*[^\0A]\00"
@.str.3 = [4 x i8] c"%*c\00"
@.str.4 = [19 x i8] c"%d - %dh %dm %ds \0A\00"
define i32 @main() {
%1 = alloca i16
%2 = alloca i16
%3 = alloca i16
%4 = bitcast i16* %1 to i8*
%5 = bitcast i16* %2 to i8*
%6 = bitcast i16* %3 to i8*
br label %7
7: ; preds = %13, %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i16* %1, i16* %2, i16* %3)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %9, 3
br i1 %12, label %14, label %13
13: ; preds = %7, %14
br label %7
14: ; preds = %7
%15 = load i16, i16* %1
%16 = zext i16 %15 to i32
%17 = load i16, i16* %2
%18 = zext i16 %17 to i32
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 3, i32 %16, i32 %18, i32 %20)
%22 = load i16, i16* %1
%23 = icmp ugt i16 %22, 23
%24 = load i16, i16* %2
%25 = icmp ugt i16 %24, 59
%26 = select i1 %23, i1 true, i1 %25
%27 = load i16, i16* %3
%28 = icmp ugt i16 %27, 59
%29 = select i1 %26, i1 true, i1 %28
br i1 %29, label %13, label %30
30: ; preds = %14
ret i32 1
}