#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 atoi(char *);
int /*<<< orphan*/ date_ticker_day(int, char *);
int /*<<< orphan*/ date_ticker_hour(int, char *);
int /*<<< orphan*/ date_ticker_minute(int, char *);
int /*<<< orphan*/ date_ticker_month(int, char *);
int /*<<< orphan*/ date_ticker_second(int, char *);
int /*<<< orphan*/ date_ticker_week(int, char *);
int /*<<< orphan*/ date_ticker_year(int, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *period;
  int how_many;
  char *start_date = {0};
  if (argc < 3) {
    fprintf(stderr,
            "Usage: %s second|minute|hour|day|week|month|year how_many "
            "[start_date]\n",
            argv[0]);
    exit(1);
  }
  period = argv[1];
  how_many = atoi(argv[2]);
  if (argc == 4)
    start_date = argv[3];
  if (strcmp(period, "second") == 0) {
    date_ticker_second(how_many, start_date);
  } else if (strcmp(period, "minute") == 0) {
    date_ticker_minute(how_many, start_date);
  } else if (strcmp(period, "hour") == 0) {
    date_ticker_hour(how_many, start_date);
  } else if (strcmp(period, "day") == 0) {
    date_ticker_day(how_many, start_date);
  } else if (strcmp(period, "week") == 0) {
    date_ticker_week(how_many, start_date);
  } else if (strcmp(period, "month") == 0) {
    date_ticker_month(how_many, start_date);
  } else if (strcmp(period, "year") == 0) {
    date_ticker_year(how_many, start_date);
  } else {
    fprintf(stderr, "Error in %s: invalid period = (%s)\n", argv[0], period);
    exit(1);
  }
  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)
movq   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1200 <main+0x50>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe11(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    1232 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    125d <main+0xad>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1070 <date_ticker_second@plt>
jmp    13a9 <main+0x1f9>
mov    -0x18(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1288 <main+0xd8>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   10d0 <date_ticker_minute@plt>
jmp    13a4 <main+0x1f4>
mov    -0x18(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12b3 <main+0x103>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1080 <date_ticker_hour@plt>
jmp    139f <main+0x1ef>
mov    -0x18(%rbp),%rdi
lea    0xd9d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12de <main+0x12e>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1050 <date_ticker_day@plt>
jmp    139a <main+0x1ea>
mov    -0x18(%rbp),%rdi
lea    0xd76(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1309 <main+0x159>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   10c0 <date_ticker_week@plt>
jmp    1395 <main+0x1e5>
mov    -0x18(%rbp),%rdi
lea    0xd50(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1334 <main+0x184>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   10b0 <date_ticker_month@plt>
jmp    1390 <main+0x1e0>
mov    -0x18(%rbp),%rdi
lea    0xd2b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    135f <main+0x1af>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1060 <date_ticker_year@plt>
jmp    138b <main+0x1db>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    1390 <main+0x1e0>
jmp    1395 <main+0x1e5>
jmp    139a <main+0x1ea>
jmp    139f <main+0x1ef>
jmp    13a4 <main+0x1f4>
jmp    13a9 <main+0x1f9>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
cmp    $0x2,%edi
jle    12e0 <main+0x130>
mov    %edi,%ebp
mov    0x8(%r14),%rbx
mov    0x10(%r14),%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
cmp    $0x4,%ebp
jne    11e1 <main+0x31>
mov    0x18(%r14),%r15
jmp    11e4 <main+0x34>
xor    %r15d,%r15d
lea    0xe5d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1289 <main+0xd9>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1296 <main+0xe6>
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12a3 <main+0xf3>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12b0 <main+0x100>
lea    0xe1c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12bd <main+0x10d>
lea    0xe0d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12ca <main+0x11a>
lea    0xdff(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1304 <main+0x154>
mov    %r12d,%edi
mov    %r15,%rsi
call   1060 <date_ticker_year@plt>
jmp    12d5 <main+0x125>
mov    %r12d,%edi
mov    %r15,%rsi
call   1070 <date_ticker_second@plt>
jmp    12d5 <main+0x125>
mov    %r12d,%edi
mov    %r15,%rsi
call   10d0 <date_ticker_minute@plt>
jmp    12d5 <main+0x125>
mov    %r12d,%edi
mov    %r15,%rsi
call   1080 <date_ticker_hour@plt>
jmp    12d5 <main+0x125>
mov    %r12d,%edi
mov    %r15,%rsi
call   1050 <date_ticker_day@plt>
jmp    12d5 <main+0x125>
mov    %r12d,%edi
mov    %r15,%rsi
call   10c0 <date_ticker_week@plt>
jmp    12d5 <main+0x125>
mov    %r12d,%edi
mov    %r15,%rsi
call   10b0 <date_ticker_month@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd0d(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd58(%rip),%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [72 x i8] c"Usage: %s second|minute|hour|day|week|month|year how_many [start_date]\0A\00"
@.str.1 = [7 x i8] c"second\00"
@.str.2 = [7 x i8] c"minute\00"
@.str.3 = [5 x i8] c"hour\00"
@.str.4 = [4 x i8] c"day\00"
@.str.5 = [5 x i8] c"week\00"
@.str.6 = [6 x i8] c"month\00"
@.str.7 = [5 x i8] c"year\00"
@.str.8 = [36 x i8] c"Error in %s: invalid period = (%s)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %8
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
store i8* %21, i8** %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %7
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 4
br i1 %27, label %28, label %32
28: ; preds = %18
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
store i8* %31, i8** %8
br label %32
32: ; preds = %28, %18
%33 = load i8*, i8** %6
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* %7
%38 = load i8*, i8** %8
%39 = call i32 @date_ticker_second(i32 %37, i8* %38)
br label %102
40: ; preds = %32
%41 = load i8*, i8** %6
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i32, i32* %7
%46 = load i8*, i8** %8
%47 = call i32 @date_ticker_minute(i32 %45, i8* %46)
br label %101
48: ; preds = %40
%49 = load i8*, i8** %6
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %48
%53 = load i32, i32* %7
%54 = load i8*, i8** %8
%55 = call i32 @date_ticker_hour(i32 %53, i8* %54)
br label %100
56: ; preds = %48
%57 = load i8*, i8** %6
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i32, i32* %7
%62 = load i8*, i8** %8
%63 = call i32 @date_ticker_day(i32 %61, i8* %62)
br label %99
64: ; preds = %56
%65 = load i8*, i8** %6
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = load i32, i32* %7
%70 = load i8*, i8** %8
%71 = call i32 @date_ticker_week(i32 %69, i8* %70)
br label %98
72: ; preds = %64
%73 = load i8*, i8** %6
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %72
%77 = load i32, i32* %7
%78 = load i8*, i8** %8
%79 = call i32 @date_ticker_month(i32 %77, i8* %78)
br label %97
80: ; preds = %72
%81 = load i8*, i8** %6
%82 = call i64 @strcmp(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %80
%85 = load i32, i32* %7
%86 = load i8*, i8** %8
%87 = call i32 @date_ticker_year(i32 %85, i8* %86)
br label %96
88: ; preds = %80
%89 = load i32, i32* @stderr
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 0
%92 = load i8*, i8** %91
%93 = load i8*, i8** %6
%94 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* %92, i8* %93)
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %84
br label %97
97: ; preds = %96, %76
br label %98
98: ; preds = %97, %68
br label %99
99: ; preds = %98, %60
br label %100
100: ; preds = %99, %52
br label %101
101: ; preds = %100, %44
br label %102
102: ; preds = %101, %36
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [72 x i8] c"Usage: %s second|minute|hour|day|week|month|year how_many [start_date]\0A\00"
@.str.1 = [7 x i8] c"second\00"
@.str.2 = [7 x i8] c"minute\00"
@.str.3 = [5 x i8] c"hour\00"
@.str.4 = [4 x i8] c"day\00"
@.str.5 = [5 x i8] c"week\00"
@.str.6 = [6 x i8] c"month\00"
@.str.7 = [5 x i8] c"year\00"
@.str.8 = [36 x i8] c"Error in %s: invalid period = (%s)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp eq i32 %0, 4
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
br label %19
19: ; preds = %16, %9
%20 = phi i8* [ %18, %16 ], [ null, %9 ]
%21 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i32 @date_ticker_second(i32 %14, i8* %20)
br label %60
25: ; preds = %19
%26 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @date_ticker_minute(i32 %14, i8* %20)
br label %60
30: ; preds = %25
%31 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 @date_ticker_hour(i32 %14, i8* %20)
br label %60
35: ; preds = %30
%36 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call i32 @date_ticker_day(i32 %14, i8* %20)
br label %60
40: ; preds = %35
%41 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 @date_ticker_week(i32 %14, i8* %20)
br label %60
45: ; preds = %40
%46 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = tail call i32 @date_ticker_month(i32 %14, i8* %20)
br label %60
50: ; preds = %45
%51 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = tail call i32 @date_ticker_year(i32 %14, i8* %20)
br label %60
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %1
%58 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* %57, i8* %11)
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %28, %38, %48, %53, %43, %33, %23
ret i32 0
}