// File: /workspace/github_c_makefile_star2_O0/ukontainer[P]sqlite-bench/benchmark.c
// Function: benchmark_open
void benchmark_open() {
  assert(db_ == NULL);

  int status;
  char file_name[100];
  char* err_msg = NULL;
  db_num_++;

  /* Open database */
  char *tmp_dir = FLAGS_db;
  snprintf(file_name, sizeof(file_name),
            "%sdbbench_sqlite3-%d.db",
            tmp_dir,
            db_num_);
  status = sqlite3_open(file_name, &db_);
  if (status) {
    fprintf(stderr, "open error: %s\n", sqlite3_errmsg(db_));
    exit(1);
  }

  /* Change SQLite cache size */
  char cache_size[100];
  snprintf(cache_size, sizeof(cache_size), "PRAGMA cache_size = %d",
            FLAGS_num_pages);
  status = sqlite3_exec(db_, cache_size, NULL, NULL, &err_msg);
  exec_error_check(status, err_msg);

  /* FLAGS_page_size is defaulted to 1024 */
  if (FLAGS_page_size != 1024) {
    char page_size[100];
    snprintf(page_size, sizeof(page_size), "PRAGMA page_size = %d",
              FLAGS_page_size);
    status = sqlite3_exec(db_, page_size, NULL, NULL, &err_msg);
    exec_error_check(status, err_msg);
  }

  /* Change journal mode to WAL if WAL enabled flag is on */
  if (FLAGS_WAL_enabled) {
    char* WAL_stmt = "PRAGMA journal_mode = WAL";

    /* Default cache size is a combined 4 MB */
    char* WAL_checkpoint = "PRAGMA wal_autocheckpoint = 4096";
    status = sqlite3_exec(db_, WAL_stmt, NULL, NULL, &err_msg);
    exec_error_check(status, err_msg);
    status = sqlite3_exec(db_, WAL_checkpoint, NULL, NULL, &err_msg);
    exec_error_check(status, err_msg);
  }

  /* Change locking mode to exclusive and create tables/index for database */
  char* locking_stmt = "PRAGMA locking_mode = EXCLUSIVE";
  char* create_stmt =
          "CREATE TABLE test (key blob, value blob, PRIMARY KEY (key))";
  char* stmt_array[] = { locking_stmt, create_stmt, NULL };
  int stmt_array_length = sizeof(stmt_array) / sizeof(char*);
  for (int i = 0; i < stmt_array_length; i++) {
    status = sqlite3_exec(db_, stmt_array[i], NULL, NULL, &err_msg);
    exec_error_check(status, err_msg);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
cmpq $0x0, 0x1d039d(%rip)    # 0x5d28f0
jne 0x402557
jmp 0x402576
leaq 0x174be6(%rip), %rdi    # 0x577144
leaq 0x174beb(%rip), %rsi    # 0x577150
movl $0x141, %edx            # imm = 0x141
leaq 0x174beb(%rip), %rcx    # 0x57715c
callq 0x4ace30
movq $0x0, -0x78(%rbp)
movl 0x1d0374(%rip), %eax    # 0x5d28f8
addl $0x1, %eax
movl %eax, 0x1d036b(%rip)    # 0x5d28f8
movq $0x5d2970, %rax         # imm = 0x5D2970
movq (%rax), %rax
movq %rax, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x80(%rbp), %rcx
movl 0x1d034e(%rip), %r8d    # 0x5d28f8
movl $0x64, %esi
leaq 0x174bbc(%rip), %rdx    # 0x577172
movb $0x0, %al
callq 0x4b4180
leaq -0x70(%rbp), %rdi
leaq 0x1d0328(%rip), %rsi    # 0x5d28f0
callq 0x4183f0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x402615
movq $0x5d07a8, %rax         # imm = 0x5D07A8
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
movq 0x1d0302(%rip), %rdi    # 0x5d28f0
callq 0x412d10
movq -0x1b0(%rbp), %rdi
movq %rax, %rdx
leaq 0x174b86(%rip), %rsi    # 0x57718a
movb $0x0, %al
callq 0x4b40c0
movl $0x1, %edi
callq 0x4b3590
leaq -0xf0(%rbp), %rdi
movq $0x5d2964, %rax         # imm = 0x5D2964
movl (%rax), %ecx
movl $0x64, %esi
leaq 0x174b69(%rip), %rdx    # 0x57719a
movb $0x0, %al
callq 0x4b4180
movq 0x1d02b1(%rip), %rdi    # 0x5d28f0
leaq -0xf0(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x78(%rbp), %r8
movq %rcx, %rdx
callq 0x412850
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
movq -0x78(%rbp), %rsi
callq 0x4031e0
movq $0x5d2960, %rax         # imm = 0x5D2960
cmpl $0x400, (%rax)          # imm = 0x400
je 0x4026c4
leaq -0x160(%rbp), %rdi
movq $0x5d2960, %rax         # imm = 0x5D2960
movl (%rax), %ecx
movl $0x64, %esi
leaq 0x174b21(%rip), %rdx    # 0x5771b1
movb $0x0, %al
callq 0x4b4180
movq 0x1d0252(%rip), %rdi    # 0x5d28f0
leaq -0x160(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x78(%rbp), %r8
movq %rcx, %rdx
callq 0x412850
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
movq -0x78(%rbp), %rsi
callq 0x4031e0
movq $0x5d296a, %rax         # imm = 0x5D296A
testb $0x1, (%rax)
je 0x402746
leaq 0x174af0(%rip), %rax    # 0x5771c7
movq %rax, -0x168(%rbp)
leaq 0x174afc(%rip), %rax    # 0x5771e1
movq %rax, -0x170(%rbp)
movq 0x1d01fd(%rip), %rdi    # 0x5d28f0
movq -0x168(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x78(%rbp), %r8
movq %rcx, %rdx
callq 0x412850
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
movq -0x78(%rbp), %rsi
callq 0x4031e0
movq 0x1d01d0(%rip), %rdi    # 0x5d28f0
movq -0x170(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x78(%rbp), %r8
movq %rcx, %rdx
callq 0x412850
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
movq -0x78(%rbp), %rsi
callq 0x4031e0
leaq 0x174ab5(%rip), %rax    # 0x577202
movq %rax, -0x178(%rbp)
leaq 0x174ac7(%rip), %rax    # 0x577222
movq %rax, -0x180(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0x198(%rbp)
movq $0x0, -0x190(%rbp)
movl $0x3, -0x1a4(%rbp)
movl $0x0, -0x1a8(%rbp)
movl -0x1a8(%rbp), %eax
cmpl -0x1a4(%rbp), %eax
jge 0x4027f1
movq 0x1d013e(%rip), %rdi    # 0x5d28f0
movslq -0x1a8(%rbp), %rax
movq -0x1a0(%rbp,%rax,8), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x78(%rbp), %r8
movq %rcx, %rdx
callq 0x412850
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
movq -0x78(%rbp), %rsi
callq 0x4031e0
movl -0x1a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a8(%rbp)
jmp 0x40279d
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw (%rax,%rax)