#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*/ clear_standard_input_line();
int /*<<< orphan*/ printf(char *);
int scanf(char *, char *, int *, int *, int *, int *);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
void get_period_filter(char weekday[], char start_time[], char end_time[]) {
  int start_hour, start_min, end_hour, end_min, scan_res, valid_input = 0;
  do {
    printf("Enter a valid filter like \"Fre 18.05 19.05\": ");
    scan_res = scanf(" %3s %d.%d %d.%d", weekday, &start_hour, &start_min,
                     &end_hour, &end_min);
    if (scan_res == 5)
      valid_input = 1;
    clear_standard_input_line();
  } while (!valid_input);
  sprintf(start_time, "%02d.%02d", start_hour, start_min);
  sprintf(end_time, "%02d.%02d", end_hour, end_min);
}


x86 assembly (clang, -O0):
<get_period_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x30(%rbp)
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xebc(%rip),%rdi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1040 <scanf@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jne    119b <get_period_filter+0x5b>
movl   $0x1,-0x30(%rbp)
mov    $0x0,%al
call   1050 <clear_standard_input_line@plt>
cmpl   $0x0,-0x30(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115b <get_period_filter+0x1b>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe7b(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xe65(%rip),%rsi
call   1060 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_period_filter>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
lea    0x14(%rsp),%rbp
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
nop
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   1040 <scanf@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1050 <clear_standard_input_line@plt>
cmp    $0x5,%r13d
jne    1170 <get_period_filter+0x30>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
lea    0xe89(%rip),%rbx
mov    0x18(%rsp),%rdi
mov    %rbx,%rsi
call   1060 <sprintf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x20(%rsp),%rdi
mov    %rbx,%rsi
call   1060 <sprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Enter a valid filter like \22Fre 18.05 19.05\22: \00"
@.str.1 = [17 x i8] c" %3s %d.%d %d.%d\00"
@.str.2 = [10 x i8] c"%02d.%02d\00"
define void @get_period_filter(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %12
br label %13
13: ; preds = %22, %3
%14 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %4
%16 = call i32 @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32* %7, i32* %8, i32* %9, i32* %10)
store i32 %16, i32* %11
%17 = load i32, i32* %11
%18 = icmp eq i32 %17, 5
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 1, i32* %12
br label %20
20: ; preds = %19, %13
%21 = call i32 (...) @clear_standard_input_line()
br label %22
22: ; preds = %20
%23 = load i32, i32* %12
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
br i1 %25, label %13, label %26
26: ; preds = %22
%27 = load i8*, i8** %5
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i8*, i8** %6
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"Enter a valid filter like \22Fre 18.05 19.05\22: \00"
@.str.1 = [17 x i8] c" %3s %d.%d %d.%d\00"
@.str.2 = [10 x i8] c"%02d.%02d\00"
define void @get_period_filter(i8* %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
br label %12
12: ; preds = %12, %3
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32* %4, i32* %5, i32* %6, i32* %7)
%15 = icmp eq i32 %14, 5
%16 = call i32 (...) @clear_standard_input_line()
br i1 %15, label %17, label %12
17: ; preds = %12
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %19)
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
ret void
}