#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ stderr;
scalar_t__ strptime(char *, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_interval(int argc, char **argv, time_t *startDate, time_t *endDate) {
  time_t t;
  struct tm *refDate;
  int tday, tmon, tyear;
  if (argc == 2) {
    t = time(NULL);
    refDate = localtime(&t);
    if (strptime(argv[1], "%d-%m-%Y", refDate)) {
      *startDate = mktime(refDate);
      *endDate = *startDate;
    } else {
      *startDate = 0;
      *endDate = 0;
    }
  } else if (argc == 3) {
    t = time(NULL);
    refDate = localtime(&t);
    *startDate = strptime(argv[1], "%d-%m-%Y", refDate) ? mktime(refDate) : 0;
    *endDate = strptime(argv[2], "%d-%m-%Y", refDate) ? mktime(refDate) : 0;
  } else {
    *startDate = 0;
    *endDate = 0;
  }
  if (!*startDate)
    fprintf(stderr,
            "Formato de data inválido para '%s'. A data deve ser informada no "
            "formato dd-mm-aaaa.\n",
            argv[1]);
  else if (!*endDate)
    fprintf(stderr,
            "Formato de data inválido para '%s'. A data deve ser informada no "
            "formato dd-mm-aaaa.\n",
            argv[2]);
}


x86 assembly (clang, -O0):
<get_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11e7 <get_interval+0x97>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x24(%rbp)
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe63(%rip),%rsi
call   1070 <strptime@plt>
cmp    $0x0,%rax
je     11ce <get_interval+0x7e>
mov    -0x30(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11e2 <get_interval+0x92>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    12b4 <get_interval+0x164>
cmpl   $0x3,-0x4(%rbp)
jne    129b <get_interval+0x14b>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x24(%rbp)
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x30(%rbp),%rdx
lea    0xde3(%rip),%rsi
call   1070 <strptime@plt>
cmp    $0x0,%rax
je     123d <get_interval+0xed>
mov    -0x30(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x40(%rbp)
jmp    1247 <get_interval+0xf7>
xor    %eax,%eax
mov    %eax,-0x40(%rbp)
jmp    1247 <get_interval+0xf7>
mov    -0x40(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x30(%rbp),%rdx
lea    0xd9d(%rip),%rsi
call   1070 <strptime@plt>
cmp    $0x0,%rax
je     1283 <get_interval+0x133>
mov    -0x30(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x44(%rbp)
jmp    128d <get_interval+0x13d>
xor    %eax,%eax
mov    %eax,-0x44(%rbp)
jmp    128d <get_interval+0x13d>
mov    -0x44(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    12af <get_interval+0x15f>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    12b4 <get_interval+0x164>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    12e3 <get_interval+0x193>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd30(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1312 <get_interval+0x1c2>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    130d <get_interval+0x1bd>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd01(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1312 <get_interval+0x1c2>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_interval>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r14
cmp    $0x3,%edi
je     11ba <get_interval+0x6a>
cmp    $0x2,%edi
jne    1224 <get_interval+0xd4>
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r13
mov    0x8(%r14),%rdi
lea    0xe67(%rip),%rsi
mov    %rax,%rdx
call   1070 <strptime@plt>
test   %rax,%rax
je     1230 <get_interval+0xe0>
mov    %r13,%rdi
call   1060 <mktime@plt>
mov    %eax,%ebx
mov    %eax,(%r12)
jmp    1238 <get_interval+0xe8>
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r13
mov    0x8(%r14),%rdi
lea    0xe21(%rip),%rsi
mov    %rax,%rdx
call   1070 <strptime@plt>
mov    %rax,%rcx
mov    $0x0,%eax
test   %rcx,%rcx
je     11fc <get_interval+0xac>
mov    %r13,%rdi
call   1060 <mktime@plt>
mov    %eax,(%r12)
mov    0x10(%r14),%rdi
lea    0xdf5(%rip),%rsi
mov    %r13,%rdx
call   1070 <strptime@plt>
test   %rax,%rax
je     1238 <get_interval+0xe8>
mov    %r13,%rdi
call   1060 <mktime@plt>
mov    %eax,%ebx
jmp    1238 <get_interval+0xe8>
movl   $0x0,(%r12)
xor    %ebx,%ebx
jmp    1238 <get_interval+0xe8>
movl   $0x0,(%r12)
mov    %ebx,(%r15)
cmpl   $0x0,(%r12)
je     124d <get_interval+0xfd>
test   %ebx,%ebx
jne    126b <get_interval+0x11b>
mov    $0x2,%eax
jmp    1252 <get_interval+0x102>
mov    $0x1,%eax
mov    0x2d87(%rip),%rcx
mov    (%rcx),%edi
mov    (%r14,%rax,8),%rdx
lea    0xda3(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [9 x i8] c"%d-%m-%Y\00"
@stderr = global i32 0
@.str.1 = [87 x i8] c"Formato de data inv\C3\A1lido para '%s'. A data deve ser informada no formato dd-mm-aaaa.\0A\00"
define void @get_interval(i32 %0, i8** %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca %struct.tm*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %36
16: ; preds = %4
%17 = call i32 @time(i32* null)
store i32 %17, i32* %9
%18 = call %struct.tm* @localtime(i32* %9)
store %struct.tm* %18, %struct.tm** %10
%19 = load i8**, i8*** %6
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load %struct.tm*, %struct.tm** %10
%23 = call i64 @strptime(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %16
%26 = load %struct.tm*, %struct.tm** %10
%27 = call i32 @mktime(%struct.tm* %26)
%28 = load i32*, i32** %7
store i32 %27, i32* %28
%29 = load i32*, i32** %7
%30 = load i32, i32* %29
%31 = load i32*, i32** %8
store i32 %30, i32* %31
br label %35
32: ; preds = %16
%33 = load i32*, i32** %7
store i32 0, i32* %33
%34 = load i32*, i32** %8
store i32 0, i32* %34
br label %35
35: ; preds = %32, %25
br label %72
36: ; preds = %4
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 3
br i1 %38, label %39, label %68
39: ; preds = %36
%40 = call i32 @time(i32* null)
store i32 %40, i32* %9
%41 = call %struct.tm* @localtime(i32* %9)
store %struct.tm* %41, %struct.tm** %10
%42 = load i8**, i8*** %6
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = load %struct.tm*, %struct.tm** %10
%46 = call i64 @strptime(i8* %44, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %39
%49 = load %struct.tm*, %struct.tm** %10
%50 = call i32 @mktime(%struct.tm* %49)
br label %52
51: ; preds = %39
br label %52
52: ; preds = %51, %48
%53 = phi i32 [ %50, %48 ], [ 0, %51 ]
%54 = load i32*, i32** %7
store i32 %53, i32* %54
%55 = load i8**, i8*** %6
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = load %struct.tm*, %struct.tm** %10
%59 = call i64 @strptime(i8* %57, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %52
%62 = load %struct.tm*, %struct.tm** %10
%63 = call i32 @mktime(%struct.tm* %62)
br label %65
64: ; preds = %52
br label %65
65: ; preds = %64, %61
%66 = phi i32 [ %63, %61 ], [ 0, %64 ]
%67 = load i32*, i32** %8
store i32 %66, i32* %67
br label %71
68: ; preds = %36
%69 = load i32*, i32** %7
store i32 0, i32* %69
%70 = load i32*, i32** %8
store i32 0, i32* %70
br label %71
71: ; preds = %68, %65
br label %72
72: ; preds = %71, %35
%73 = load i32*, i32** %7
%74 = load i32, i32* %73
%75 = icmp ne i32 %74, 0
br i1 %75, label %82, label %76
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = load i8**, i8*** %6
%79 = getelementptr inbounds i8*, i8** %78, i64 1
%80 = load i8*, i8** %79
%81 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.1, i64 0, i64 0), i8* %80)
br label %93
82: ; preds = %72
%83 = load i32*, i32** %8
%84 = load i32, i32* %83
%85 = icmp ne i32 %84, 0
br i1 %85, label %92, label %86
86: ; preds = %82
%87 = load i32, i32* @stderr
%88 = load i8**, i8*** %6
%89 = getelementptr inbounds i8*, i8** %88, i64 2
%90 = load i8*, i8** %89
%91 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.1, i64 0, i64 0), i8* %90)
br label %92
92: ; preds = %86, %82
br label %93
93: ; preds = %92, %76
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [9 x i8] c"%d-%m-%Y\00"
@stderr = global i32 0
@.str.1 = [87 x i8] c"Formato de data inv\C3\A1lido para '%s'. A data deve ser informada no formato dd-mm-aaaa.\0A\00"
define void @get_interval(i32 %0, i8** nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
switch i32 %0, label %34 [
i32 2, label %7
i32 3, label %17
]
7: ; preds = %4
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %5
%9 = call %struct.tm* @localtime(i32* %5)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strptime(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %7
%15 = call i32 @mktime(%struct.tm* %9)
store i32 %15, i32* %2
br label %35
16: ; preds = %7
store i32 0, i32* %2
br label %35
17: ; preds = %4
%18 = tail call i32 @time(i32* null)
store i32 %18, i32* %5
%19 = call %struct.tm* @localtime(i32* %5)
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @strptime(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %19)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %17
%25 = call i32 @mktime(%struct.tm* %19)
br label %26
26: ; preds = %17, %24
%27 = phi i32 [ %25, %24 ], [ 0, %17 ]
store i32 %27, i32* %2
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = call i64 @strptime(i8* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %19)
%31 = icmp eq i64 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %26
%33 = call i32 @mktime(%struct.tm* %19)
br label %35
34: ; preds = %4
store i32 0, i32* %2
br label %35
35: ; preds = %32, %26, %34, %14, %16
%36 = phi i32 [ 0, %34 ], [ %15, %14 ], [ 0, %16 ], [ %33, %32 ], [ 0, %26 ]
store i32 %36, i32* %3
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %35
%40 = icmp eq i32 %36, 0
br i1 %40, label %41, label %47
41: ; preds = %39, %35
%42 = phi i64 [ 1, %35 ], [ 2, %39 ]
%43 = load i32, i32* @stderr
%44 = getelementptr inbounds i8*, i8** %1, i64 %42
%45 = load i8*, i8** %44
%46 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.1, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %41, %39
ret void
}