#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*/ adb(char *, char *);
int /*<<< orphan*/ exit(int);
char getch();
char gets();
int /*<<< orphan*/ printdb(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  char run = 'r';
  while (run == 'r') {
    system("cls");
    printf("***This program was created by Abdulla***\n if you don't know how "
           "to use the program inter 'h'\n");
    run = gets();
    if (run == 'h') {
      system("cls");
      printf("***This program was created by Abdulla***\n if you don't know "
             "how to use the program inter 'h'\n");
      printf("\nHELP MENU:\n a: add data\np: print all data\nh: shows this "
             "page\nq: to exit the program\n");
      run = getch();
    }
    if (run == 'a') {
      system("cls");
      printf("***This program was created by Abdulla***\n if you don't know "
             "how to use the program inter 'h'\n");
      char name[255];
      printf("Type the name you want to save in the data:   ");
      scanf("%s", name);
      adb(name, "db.db");
      run = getch();
    }
    if (run == 'p') {
      system("cls");
      printf("***This program was created by Abdulla***\n if you don't know "
             "how to use the program inter 'h'\n");
      printdb("db.db", 255);
    }
    run = getch();
  }
  if (run == 'q') {
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x72,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x72,%eax
jne    12a6 <main+0x126>
lea    0xe56(%rip),%rdi
call   1040 <system@plt>
lea    0xe4e(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <gets@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x68,%eax
jne    1200 <main+0x80>
lea    0xe27(%rip),%rdi
call   1040 <system@plt>
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    1261 <main+0xe1>
lea    0xdec(%rip),%rdi
call   1040 <system@plt>
lea    0xde4(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1030 <adb@plt>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x70,%eax
jne    1297 <main+0x117>
lea    0xd8b(%rip),%rdi
call   1040 <system@plt>
lea    0xd83(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0xff,%esi
call   1060 <printdb@plt>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %al,-0x5(%rbp)
jmp    1196 <main+0x16>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    12bd <main+0x13d>
mov    $0x1,%edi
call   10a0 <exit@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    $0x72,%al
lea    0xe56(%rip),%r14
lea    0xe8b(%rip),%rbx
lea    0xe4c(%rip),%r12
lea    0xe74(%rip),%r13
mov    %rsp,%rbp
lea    0xe6d(%rip),%r15
jmp    11d7 <main+0x47>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <getch@plt>
cmp    $0x72,%al
jne    1296 <main+0x106>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <gets@plt>
cmp    $0x68,%al
je     1210 <main+0x80>
cmp    $0x61,%al
je     1237 <main+0xa7>
cmp    $0x70,%al
jne    11d0 <main+0x40>
jmp    1274 <main+0xe4>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
cmp    $0x61,%al
jne    11fe <main+0x6e>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1090 <scanf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <adb@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
cmp    $0x70,%al
jne    11d0 <main+0x40>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    $0xff,%esi
call   1070 <printdb@plt>
jmp    11d0 <main+0x40>
cmp    $0x71,%al
je     12ae <main+0x11e>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [95 x i8] c"***This program was created by Abdulla***\0A if you don't know how to use the program inter 'h'\0A\00"
@.str.2 = [86 x i8] c"\0AHELP MENU:\0A a: add data\0Ap: print all data\0Ah: shows this page\0Aq: to exit the program\0A\00"
@.str.3 = [47 x i8] c"Type the name you want to save in the data: \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [6 x i8] c"db.db\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [255 x i8]
store i32 0, i32* %1
store i8 114, i8* %2
br label %4
4: ; preds = %41, %0
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 114
br i1 %7, label %8, label %43
8: ; preds = %4
%9 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0))
%11 = call signext i8 (...) @gets()
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 104
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.2, i64 0, i64 0))
%19 = call signext i8 (...) @getch()
store i8 %19, i8* %2
br label %20
20: ; preds = %15, %8
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 97
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
%28 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%31 = call i32 @adb(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%32 = call signext i8 (...) @getch()
store i8 %32, i8* %2
br label %33
33: ; preds = %24, %20
%34 = load i8, i8* %2
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 112
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @printdb(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 255)
br label %41
41: ; preds = %37, %33
%42 = call signext i8 (...) @getch()
store i8 %42, i8* %2
br label %4
43: ; preds = %4
%44 = load i8, i8* %2
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 113
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.3 = [47 x i8] c"Type the name you want to save in the data: \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [6 x i8] c"db.db\00"
@str.8 = [94 x i8] c"***This program was created by Abdulla***\0A if you don't know how to use the program inter 'h'\00"
@str.9 = [85 x i8] c"\0AHELP MENU:\0A a: add data\0Ap: print all data\0Ah: shows this page\0Aq: to exit the program\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %32, %0
%4 = phi i8 [ 114, %0 ], [ %33, %32 ]
switch i8 %4, label %36 [
i8 114, label %5
i8 113, label %34
]
5: ; preds = %3
%6 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.8, i64 0, i64 0))
%8 = call signext i8 (...) @gets()
%9 = icmp eq i8 %8, 104
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.8, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.9, i64 0, i64 0))
%14 = call signext i8 (...) @getch()
br label %15
15: ; preds = %10, %5
%16 = phi i8 [ %14, %10 ], [ %8, %5 ]
%17 = icmp eq i8 %16, 97
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.8, i64 0, i64 0))
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%23 = call i32 @adb(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%24 = call signext i8 (...) @getch()
br label %25
25: ; preds = %18, %15
%26 = phi i8 [ %24, %18 ], [ %16, %15 ]
%27 = icmp eq i8 %26, 112
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.8, i64 0, i64 0))
%31 = call i32 @printdb(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 255)
br label %32
32: ; preds = %28, %25
%33 = call signext i8 (...) @getch()
br label %3
34: ; preds = %3
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %3
ret i32 0
}