#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*/ cp_picture_folder(char *);
int /*<<< orphan*/ create_db();
int /*<<< orphan*/ delete_id_db(char *);
int /*<<< orphan*/ destroy_db();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ insert(char *, char *);
int /*<<< orphan*/ insert_folder(char const *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ see_all_db();
int main(int argc, char const *argv[]) {
  create_db();
  getchar();
  insert("'name of person 1'", "'path of picture'");
  getchar();
  insert("'name of person 2'", "'path of picture'");
  getchar();
  delete_id_db("2");
  getchar();
  see_all_db();
  getchar();
  destroy_db();
  getchar();
  create_db();
  getchar();
  cp_picture_folder("test/test.png");
  getchar();
  if (argc > 0) {
    insert_folder(argv[0]);
  } else {
    printf("Error, no arguments\n");
  }
  see_all_db();
  destroy_db();
  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)
mov    $0x0,%al
call   1080 <create_db@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xe45(%rip),%rdi
lea    0xe51(%rip),%rsi
call   10b0 <insert@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xe50(%rip),%rdi
lea    0xe37(%rip),%rsi
call   10b0 <insert@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xe49(%rip),%rdi
call   10a0 <delete_id_db@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x0,%al
call   1090 <see_all_db@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x0,%al
call   1040 <destroy_db@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x0,%al
call   1080 <create_db@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xe0e(%rip),%rdi
call   1030 <cp_picture_folder@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1253 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <insert_folder@plt>
jmp    125f <main+0xcf>
lea    0xdee(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <see_all_db@plt>
mov    $0x0,%al
call   1040 <destroy_db@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <create_db@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe52(%rip),%rdi
lea    0xe5e(%rip),%rbx
mov    %rbx,%rsi
call   10b0 <insert@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe5a(%rip),%rdi
mov    %rbx,%rsi
call   10b0 <insert@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe57(%rip),%rdi
call   10a0 <delete_id_db@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1090 <see_all_db@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1050 <destroy_db@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1080 <create_db@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe1c(%rip),%rdi
call   1030 <cp_picture_folder@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
test   %ebp,%ebp
jle    1238 <main+0xa8>
mov    (%r14),%rdi
call   1060 <insert_folder@plt>
jmp    1244 <main+0xb4>
lea    0xe09(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <see_all_db@plt>
xor    %eax,%eax
call   1050 <destroy_db@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"'name of person 1'\00"
@.str.1 = [18 x i8] c"'path of picture'\00"
@.str.2 = [19 x i8] c"'name of person 2'\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [14 x i8] c"test/test.png\00"
@.str.5 = [21 x i8] c"Error, no arguments\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 (...) @create_db()
%7 = call i32 (...) @getchar()
%8 = call i32 @insert(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (...) @getchar()
%10 = call i32 @insert(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (...) @getchar()
%12 = call i32 @delete_id_db(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (...) @getchar()
%14 = call i32 (...) @see_all_db()
%15 = call i32 (...) @getchar()
%16 = call i32 (...) @destroy_db()
%17 = call i32 (...) @getchar()
%18 = call i32 (...) @create_db()
%19 = call i32 (...) @getchar()
%20 = call i32 @cp_picture_folder(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 (...) @getchar()
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @insert_folder(i8* %27)
br label %31
29: ; preds = %2
%30 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
%32 = call i32 (...) @see_all_db()
%33 = call i32 (...) @destroy_db()
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"'name of person 1'\00"
@.str.1 = [18 x i8] c"'path of picture'\00"
@.str.2 = [19 x i8] c"'name of person 2'\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [14 x i8] c"test/test.png\00"
@str = [20 x i8] c"Error, no arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @create_db()
%4 = tail call i32 (...) @getchar()
%5 = tail call i32 @insert(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @getchar()
%7 = tail call i32 @insert(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @getchar()
%9 = tail call i32 @delete_id_db(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 (...) @getchar()
%11 = tail call i32 (...) @see_all_db()
%12 = tail call i32 (...) @getchar()
%13 = tail call i32 (...) @destroy_db()
%14 = tail call i32 (...) @getchar()
%15 = tail call i32 (...) @create_db()
%16 = tail call i32 (...) @getchar()
%17 = tail call i32 @cp_picture_folder(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%18 = tail call i32 (...) @getchar()
%19 = icmp sgt i32 %0, 0
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = load i8*, i8** %1
%22 = tail call i32 @insert_folder(i8* %21)
br label %25
23: ; preds = %2
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = tail call i32 (...) @see_all_db()
%27 = tail call i32 (...) @destroy_db()
ret i32 0
}