#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scripts(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int main(int argc, char *argv[]) {
  printf("VX database core v 0.01\n");
  if (argc != 3) {
    printf("No command-line arguments\n");
    exit(1);
  }
  if ((strstr(argv[1], "help")) != NULL) {
    printf("read (file name) - read db file\n");
    printf("add (name, type, data) - append variable\n");
    printf("write (file name) - write db file\n");
    printf("print (if (-1) - list all) - print tale or line\n");
  };
  if ((strstr(argv[1], "-f")) != NULL) {
    printf("Read scrpt file ->%s \n", argv[2]);
    scripts(argv[2]);
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1186 <main+0x46>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11dc <main+0x9c>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeed(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     121d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <scripts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x3,%ebx
jne    11f3 <main+0xa3>
mov    0x8(%r14),%rbx
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     11ba <main+0x6a>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%r14),%rbx
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     11e9 <main+0x99>
mov    0x10(%r14),%rsi
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r14),%rdi
call   1050 <scripts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"VX database core v 0.01\0A\00"
@.str.1 = [27 x i8] c"No command-line arguments\0A\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [33 x i8] c"read (file name) - read db file\0A\00"
@.str.4 = [42 x i8] c"add (name, type, data) - append variable\0A\00"
@.str.5 = [35 x i8] c"write (file name) - write db file\0A\00"
@.str.6 = [49 x i8] c"print (if (-1) - list all) - print tale or line\0A\00"
@.str.7 = [3 x i8] c"-f\00"
@.str.8 = [23 x i8] c"Read scrpt file ->%s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @strstr(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
br label %23
23: ; preds = %18, %12
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32* @strstr(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %38
29: ; preds = %23
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @scripts(i8* %36)
br label %38
38: ; preds = %29, %23
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"help\00"
@.str.7 = [3 x i8] c"-f\00"
@.str.8 = [23 x i8] c"Read scrpt file ->%s \0A\00"
@str = [24 x i8] c"VX database core v 0.01\00"
@str.9 = [32 x i8] c"read (file name) - read db file\00"
@str.10 = [41 x i8] c"add (name, type, data) - append variable\00"
@str.11 = [34 x i8] c"write (file name) - write db file\00"
@str.12 = [48 x i8] c"print (if (-1) - list all) - print tale or line\00"
@str.13 = [26 x i8] c"No command-line arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = icmp eq i32 %0, 3
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @strstr(i8* dereferenceable(1) %10, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %19, label %13
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.10, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.11, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.12, i64 0, i64 0))
%18 = load i8*, i8** %9
br label %19
19: ; preds = %13, %8
%20 = phi i8* [ %18, %13 ], [ %10, %8 ]
%21 = tail call i32* @strstr(i8* dereferenceable(1) %20, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %29, label %23
23: ; preds = %19
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %24
%28 = tail call i32 @scripts(i8* %27)
br label %29
29: ; preds = %23, %19
ret i32 0
}