#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*/ lang;

/* Variables and functions */
int add_entry();
int atoi(char *);
int del_entry();
int display_end();
int /*<<< orphan*/ display_help(int /*<<< orphan*/);
int /*<<< orphan*/ display_init();
int /*<<< orphan*/ display_init_windows();
int display_input();
int /*<<< orphan*/ display_list();
int /*<<< orphan*/ display_menu();
int /*<<< orphan*/ display_set_list_length();
int /*<<< orphan*/ get_user_file();
int /*<<< orphan*/ load_list();
int /*<<< orphan*/ notification_service(int);
int /*<<< orphan*/ phrases_load();
int /*<<< orphan*/ phrases_set_lang(char *);
int /*<<< orphan*/ save_list();
int /*<<< orphan*/ sort_list();
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  char lang[128] = "en-US";
  int i, notify_time_cycle = 0;
  if (argc > 2) {
    for (i = 1; i < argc; i++) {
      if (strcmp(argv[i], "-notify") == 0 && atoi(argv[i + 1]) > 0) {
        notify_time_cycle = atoi(argv[i + 1]);
      }
      if (strcmp(argv[i], "-lang") == 0 && strlen(argv[i + 1]) > 0) {
        strncpy(lang, argv[i + 1], sizeof(lang));
      }
      i++;
    }
  }
  phrases_set_lang(lang);
  phrases_load();
  get_user_file();
  if (notify_time_cycle > 0) {
    notification_service(notify_time_cycle);
  }
  load_list();
  sort_list();
  int input_id = -6, data_changed = 0;
  do {
    if (input_id == -6) {
      display_init();
      display_init_windows();
      display_menu();
      display_help(0);
      display_list();
    }
    input_id = display_input();
    switch (input_id) {
    case -2:
    case -3:
    case -4:
      data_changed = add_entry();
      break;
    case -5:
      data_changed = del_entry();
      break;
    }
    if (data_changed == 1) {
      sort_list();
      display_set_list_length();
      display_list();
      data_changed = 0;
    }
  } while (input_id != 0);
  save_list();
  return display_end();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   10a0 <memset@plt>
movb   $0x65,-0x90(%rbp)
movb   $0x6e,-0x8f(%rbp)
movb   $0x2d,-0x8e(%rbp)
movb   $0x55,-0x8d(%rbp)
movb   $0x53,-0x8c(%rbp)
movl   $0x0,-0x98(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    13d7 <main+0x177>
movl   $0x1,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13d2 <main+0x172>
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd0e(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1342 <main+0xe2>
mov    -0x10(%rbp),%rax
mov    -0x94(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1160 <atoi@plt>
cmp    $0x0,%eax
jle    1342 <main+0xe2>
mov    -0x10(%rbp),%rax
mov    -0x94(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1160 <atoi@plt>
mov    %eax,-0x98(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcb0(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    13af <main+0x14f>
mov    -0x10(%rbp),%rax
mov    -0x94(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jle    13af <main+0x14f>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x94(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x80,%edx
call   1030 <strncpy@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    12cd <main+0x6d>
jmp    13d7 <main+0x177>
lea    -0x90(%rbp),%rdi
call   1100 <phrases_set_lang@plt>
mov    $0x0,%al
call   1090 <phrases_load@plt>
mov    $0x0,%al
call   1080 <get_user_file@plt>
cmpl   $0x0,-0x98(%rbp)
jle    1409 <main+0x1a9>
mov    -0x98(%rbp),%edi
call   1070 <notification_service@plt>
mov    $0x0,%al
call   10d0 <load_list@plt>
mov    $0x0,%al
call   1150 <sort_list@plt>
movl   $0xfffffffa,-0x9c(%rbp)
ff ff ff
movl   $0x0,-0xa0(%rbp)
cmpl   $0xfffffffa,-0x9c(%rbp)
jne    145b <main+0x1fb>
mov    $0x0,%al
call   1060 <display_init@plt>
mov    $0x0,%al
call   1180 <display_init_windows@plt>
mov    $0x0,%al
call   1040 <display_menu@plt>
xor    %edi,%edi
call   10b0 <display_help@plt>
mov    $0x0,%al
call   1120 <display_list@plt>
xor    %eax,%eax
call   1170 <display_input@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
sub    $0xfffffffb,%eax
je     14ab <main+0x24b>
jmp    1482 <main+0x222>
mov    -0xa4(%rbp),%eax
add    $0x4,%eax
sub    $0x2,%eax
ja     14b8 <main+0x258>
jmp    1499 <main+0x239>
mov    $0x0,%al
call   10f0 <add_entry@plt>
mov    %eax,-0xa0(%rbp)
jmp    14b8 <main+0x258>
mov    $0x0,%al
call   1130 <del_entry@plt>
mov    %eax,-0xa0(%rbp)
cmpl   $0x1,-0xa0(%rbp)
jne    14e4 <main+0x284>
mov    $0x0,%al
call   1150 <sort_list@plt>
mov    $0x0,%al
call   1140 <display_set_list_length@plt>
mov    $0x0,%al
call   1120 <display_list@plt>
movl   $0x0,-0xa0(%rbp)
jmp    14e9 <main+0x289>
cmpl   $0x0,-0x9c(%rbp)
jne    142b <main+0x1cb>
mov    $0x0,%al
call   1110 <save_list@plt>
mov    $0x0,%al
call   10c0 <display_end@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x552d6e65,(%rsp)
movb   $0x53,0x4(%rsp)
xor    %r14d,%r14d
cmp    $0x3,%edi
jl     1323 <main+0xd3>
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
mov    $0x1,%r15d
lea    0xd50(%rip),%r12
jmp    12c9 <main+0x79>
nopw   0x0(%rax,%rax,1)
add    $0x2,%r15
cmp    %ebp,%r15d
jge    1323 <main+0xd3>
mov    (%rbx,%r15,8),%rdi
lea    0xd2c(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    12ee <main+0x9e>
mov    0x8(%rbx,%r15,8),%rdi
call   1150 <atoi@plt>
test   %eax,%eax
cmovg  %eax,%r14d
mov    (%rbx,%r15,8),%rdi
mov    %r12,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    12c0 <main+0x70>
mov    0x8(%rbx,%r15,8),%r13
mov    %r13,%rdi
call   1050 <strlen@plt>
test   %rax,%rax
jle    12c0 <main+0x70>
mov    %rsp,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
call   1030 <strncpy@plt>
jmp    12c0 <main+0x70>
mov    %rsp,%rdi
call   10f0 <phrases_set_lang@plt>
xor    %eax,%eax
call   1090 <phrases_load@plt>
xor    %eax,%eax
call   1080 <get_user_file@plt>
test   %r14d,%r14d
jle    1346 <main+0xf6>
mov    %r14d,%edi
call   1070 <notification_service@plt>
xor    %eax,%eax
call   10c0 <load_list@plt>
xor    %eax,%eax
call   1140 <sort_list@plt>
mov    $0xfffffffa,%ebx
jmp    1370 <main+0x120>
nopl   0x0(%rax,%rax,1)
cmp    $0xfffffffb,%ebx
je     13b7 <main+0x167>
test   %ebx,%ebx
je     13da <main+0x18a>
nopl   0x0(%rax)
cmp    $0xfffffffa,%ebx
jne    1398 <main+0x148>
xor    %eax,%eax
call   1060 <display_init@plt>
xor    %eax,%eax
call   1170 <display_init_windows@plt>
xor    %eax,%eax
call   1040 <display_menu@plt>
xor    %edi,%edi
call   10a0 <display_help@plt>
xor    %eax,%eax
call   1110 <display_list@plt>
xor    %eax,%eax
call   1160 <display_input@plt>
mov    %eax,%ebx
lea    0x4(%rbx),%eax
cmp    $0x3,%eax
jae    1360 <main+0x110>
xor    %eax,%eax
call   10e0 <add_entry@plt>
cmp    $0x1,%eax
jne    1370 <main+0x120>
jmp    13c3 <main+0x173>
xor    %eax,%eax
call   1120 <del_entry@plt>
cmp    $0x1,%eax
jne    1370 <main+0x120>
xor    %eax,%eax
call   1140 <sort_list@plt>
xor    %eax,%eax
call   1130 <display_set_list_length@plt>
xor    %eax,%eax
call   1110 <display_list@plt>
jmp    1370 <main+0x120>
xor    %eax,%eax
call   1100 <save_list@plt>
xor    %eax,%eax
call   10b0 <display_end@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"-notify\00"
@.str.1 = [6 x i8] c"-lang\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [128 x i8]* %6 to i8*
%12 = bitcast i8* %11 to [128 x i8]*
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i32 0, i32 0
store i8 101, i8* %13
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i32 0, i32 1
store i8 110, i8* %14
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i32 0, i32 2
store i8 45, i8* %15
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i32 0, i32 3
store i8 85, i8* %16
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i32 0, i32 4
store i8 83, i8* %17
store i32 0, i32* %8
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 2
br i1 %19, label %20, label %83
20: ; preds = %2
store i32 1, i32* %7
br label %21
21: ; preds = %79, %20
%22 = load i32, i32* %7
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %82
25: ; preds = %21
%26 = load i8**, i8*** %5
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %50
33: ; preds = %25
%34 = load i8**, i8*** %5
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %50
42: ; preds = %33
%43 = load i8**, i8*** %5
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %43, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @atoi(i8* %48)
store i32 %49, i32* %8
br label %50
50: ; preds = %42, %33, %25
%51 = load i8**, i8*** %5
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %76
58: ; preds = %50
%59 = load i8**, i8*** %5
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %59, i64 %62
%64 = load i8*, i8** %63
%65 = call i64 @strlen(i8* %64)
%66 = icmp sgt i64 %65, 0
br i1 %66, label %67, label %76
67: ; preds = %58
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%69 = load i8**, i8*** %5
%70 = load i32, i32* %7
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %69, i64 %72
%74 = load i8*, i8** %73
%75 = call i32 @strncpy(i8* %68, i8* %74, i32 128)
br label %76
76: ; preds = %67, %58, %50
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
br label %79
79: ; preds = %76
%80 = load i32, i32* %7
%81 = add nsw i32 %80, 1
store i32 %81, i32* %7
br label %21
82: ; preds = %21
br label %83
83: ; preds = %82, %2
%84 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%85 = call i32 @phrases_set_lang(i8* %84)
%86 = call i32 (...) @phrases_load()
%87 = call i32 (...) @get_user_file()
%88 = load i32, i32* %8
%89 = icmp sgt i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %83
%91 = load i32, i32* %8
%92 = call i32 @notification_service(i32 %91)
br label %93
93: ; preds = %90, %83
%94 = call i32 (...) @load_list()
%95 = call i32 (...) @sort_list()
store i32 -6, i32* %9
store i32 0, i32* %10
br label %96
96: ; preds = %120, %93
%97 = load i32, i32* %9
%98 = icmp eq i32 %97, -6
br i1 %98, label %99, label %105
99: ; preds = %96
%100 = call i32 (...) @display_init()
%101 = call i32 (...) @display_init_windows()
%102 = call i32 (...) @display_menu()
%103 = call i32 @display_help(i32 0)
%104 = call i32 (...) @display_list()
br label %105
105: ; preds = %99, %96
%106 = call i32 (...) @display_input()
store i32 %106, i32* %9
%107 = load i32, i32* %9
switch i32 %107, label %112 [
i32 -2, label %108
i32 -3, label %108
i32 -4, label %108
i32 -5, label %110
]
108: ; preds = %105, %105, %105
%109 = call i32 (...) @add_entry()
store i32 %109, i32* %10
br label %112
110: ; preds = %105
%111 = call i32 (...) @del_entry()
store i32 %111, i32* %10
br label %112
112: ; preds = %105, %110, %108
%113 = load i32, i32* %10
%114 = icmp eq i32 %113, 1
br i1 %114, label %115, label %119
115: ; preds = %112
%116 = call i32 (...) @sort_list()
%117 = call i32 (...) @display_set_list_length()
%118 = call i32 (...) @display_list()
store i32 0, i32* %10
br label %119
119: ; preds = %115, %112
br label %120
120: ; preds = %119
%121 = load i32, i32* %9
%122 = icmp ne i32 %121, 0
br i1 %122, label %96, label %123
123: ; preds = %120
%124 = call i32 (...) @save_list()
%125 = call i32 (...) @display_end()
ret i32 %125
}

LLVM IR (-O2):
@.str = [8 x i8] c"-notify\00"
@.str.1 = [6 x i8] c"-lang\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
store i8 101, i8* %4
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 1
store i8 110, i8* %5
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 2
store i8 45, i8* %6
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 3
store i8 85, i8* %7
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 4
store i8 83, i8* %8
%9 = icmp sgt i32 %0, 2
br i1 %9, label %10, label %41
10: ; preds = %2, %37
%11 = phi i64 [ %38, %37 ], [ 1, %2 ]
%12 = phi i32 [ %25, %37 ], [ 0, %2 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %11
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %10
%18 = add nuw nsw i64 %11, 1
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
%22 = icmp sgt i32 %21, 0
%23 = select i1 %22, i32 %21, i32 %12
br label %24
24: ; preds = %17, %10
%25 = phi i32 [ %12, %10 ], [ %23, %17 ]
%26 = load i8*, i8** %13
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %24
%30 = add nuw nsw i64 %11, 1
%31 = getelementptr inbounds i8*, i8** %1, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @strlen(i8* dereferenceable(1) %32)
%34 = icmp sgt i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = call i32 @strncpy(i8* %4, i8* %32, i32 128)
br label %37
37: ; preds = %35, %29, %24
%38 = add nuw i64 %11, 2
%39 = trunc i64 %38 to i32
%40 = icmp slt i32 %39, %0
br i1 %40, label %10, label %41
41: ; preds = %37, %2
%42 = phi i32 [ 0, %2 ], [ %25, %37 ]
%43 = call i32 @phrases_set_lang(i8* %4)
%44 = call i32 (...) @phrases_load()
%45 = call i32 (...) @get_user_file()
%46 = icmp sgt i32 %42, 0
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i32 @notification_service(i32 %42)
br label %49
49: ; preds = %47, %41
%50 = call i32 (...) @load_list()
%51 = call i32 (...) @sort_list()
br label %52
52: ; preds = %74, %49
%53 = phi i32 [ -6, %49 ], [ %62, %74 ]
%54 = icmp eq i32 %53, -6
br i1 %54, label %55, label %61
55: ; preds = %52
%56 = call i32 (...) @display_init()
%57 = call i32 (...) @display_init_windows()
%58 = call i32 (...) @display_menu()
%59 = call i32 @display_help(i32 0)
%60 = call i32 (...) @display_list()
br label %61
61: ; preds = %55, %52
%62 = call i32 (...) @display_input()
switch i32 %62, label %74 [
i32 -2, label %63
i32 -3, label %63
i32 -4, label %63
i32 -5, label %65
i32 0, label %75
]
63: ; preds = %61, %61, %61
%64 = call i32 (...) @add_entry()
br label %67
65: ; preds = %61
%66 = call i32 (...) @del_entry()
br label %67
67: ; preds = %65, %63
%68 = phi i32 [ %66, %65 ], [ %64, %63 ]
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %74
70: ; preds = %67
%71 = call i32 (...) @sort_list()
%72 = call i32 (...) @display_set_list_length()
%73 = call i32 (...) @display_list()
br label %74
74: ; preds = %70, %67, %61
br label %52
75: ; preds = %61
%76 = call i32 (...) @save_list()
%77 = call i32 (...) @display_end()
ret i32 %77
}