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

/* Variables and functions */
int SQLITE_OK;
int /*<<< orphan*/ W_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
int sqlite3_exec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *, char **);
int sqlite3_open(char *, int /*<<< orphan*/ **);
int /*<<< orphan*/ sys_log(char *);
int /*<<< orphan*/ system(char *);
void traffic_saved_check() {
  int traffic_saved_exist = 0;
  int rc = 0;
  sqlite3 *db = NULL;
  char *errmsg = NULL;
  int sql_cnt = 0;
  if (access("/ailvgo/system/traffic/traffic_saved.db", W_OK) == -1) {
    printf("traffic_saved.db : not exist!\n");
    sys_log("traffic_saved.db : not exist!");
    traffic_saved_exist = 0;
  } else {
    printf("traffic_saved.db : exist!\n");
    traffic_saved_exist = 1;
  }
  if (traffic_saved_exist == 0) {
    printf("creat traffic_saved.db using traffic.db\n");
    printf("cp -f /ailvgo/system/traffic/traffic.db "
           "/ailvgo/system/traffic/traffic_saved.db\n");
    system("cp -f /ailvgo/system/traffic/traffic.db "
           "/ailvgo/system/traffic/traffic_saved.db");
    sleep(1);
    sql_cnt = 0;
    while (sql_cnt < 20) {
      rc = sqlite3_open("/ailvgo/system/traffic/traffic_saved.db", &db);
      if (rc != SQLITE_OK)
        printf("Cannot open traffic_saved.db!\n");
      rc = sqlite3_exec(db, "DROP TABLE traffic_info", NULL, NULL, &errmsg);
      if (SQLITE_OK == rc) {
        printf("drop table in traffic_saved.db success!\n");
        sqlite3_close(db);
        break;
      } else {
        printf("drop table in traffic_saved.db failure!\n");
        sqlite3_close(db);
        sleep(1);
        sql_cnt++;
      }
    }
    sql_cnt = 0;
    while (sql_cnt < 20) {
      rc = sqlite3_open("/ailvgo/system/traffic/traffic_saved.db", &db);
      if (rc != SQLITE_OK)
        printf("Cannot open traffic_saved.db!\n");
      rc = sqlite3_exec(
          db, "CREATE TABLE traffic_saved (traffic TEXT, time INTEGER)", NULL,
          NULL, &errmsg);
      if (SQLITE_OK == rc) {
        printf("create table in traffic_saved.db success!\n");
        sqlite3_close(db);
        break;
      } else {
        printf("create table in traffic_saved.db failure!\n");
        sqlite3_close(db);
        sleep(1);
        sql_cnt++;
      }
    }
  } else {
    sql_cnt = 0;
    while (sql_cnt < 20) {
      rc = sqlite3_open("/ailvgo/system/traffic/traffic_saved.db", &db);
      if (rc != SQLITE_OK)
        printf("Cannot open traffic_saved.db!\n");
      rc = sqlite3_exec(db, "vacuum traffic_saved", NULL, NULL, &errmsg);
      if (SQLITE_OK == rc) {
        printf("vacumm traffic_saved.db success!\n");
        sqlite3_close(db);
        break;
      } else {
        printf("vacuum traffic_saved.db failure!\n");
        sqlite3_close(db);
        sleep(1);
        sql_cnt++;
      }
    }
  }
}


x86 assembly (clang, -O0):
<traffic_saved_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2e2c(%rip),%rax
mov    (%rax),%esi
lea    0xf3d(%rip),%rdi
call   1080 <access@plt>
cmp    $0xffffffff,%eax
jne    11ef <traffic_saved_check+0x6f>
lea    0xe2e(%rip),%rdi
call   1060 <printf@plt>
lea    0xe41(%rip),%rdi
call   1090 <sys_log@plt>
movl   $0x0,-0x4(%rbp)
jmp    1202 <traffic_saved_check+0x82>
lea    0xe47(%rip),%rdi
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    13b1 <traffic_saved_check+0x231>
lea    0xe45(%rip),%rdi
call   1060 <printf@plt>
lea    0xe62(%rip),%rdi
call   1060 <printf@plt>
lea    0xea7(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x1c(%rbp)
jge    12f3 <traffic_saved_check+0x173>
lea    0xea8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <sqlite3_open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2d80(%rip),%rcx
cmp    (%rcx),%eax
je     127c <traffic_saved_check+0xfc>
lea    0xeab(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xeba(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x8(%rbp)
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    12c6 <traffic_saved_check+0x146>
lea    0xea6(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
jmp    12f3 <traffic_saved_check+0x173>
lea    0xeb5(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1241 <traffic_saved_check+0xc1>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x1c(%rbp)
jge    13ac <traffic_saved_check+0x22c>
lea    0xdef(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <sqlite3_open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2cc7(%rip),%rcx
cmp    (%rcx),%eax
je     1335 <traffic_saved_check+0x1b5>
lea    0xdf2(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x8(%rbp)
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    137f <traffic_saved_check+0x1ff>
lea    0xe77(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
jmp    13ac <traffic_saved_check+0x22c>
lea    0xe88(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12fa <traffic_saved_check+0x17a>
jmp    146f <traffic_saved_check+0x2ef>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x1c(%rbp)
jge    146a <traffic_saved_check+0x2ea>
lea    0xd31(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <sqlite3_open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2c09(%rip),%rcx
cmp    (%rcx),%eax
je     13f3 <traffic_saved_check+0x273>
lea    0xd34(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe3b(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x8(%rbp)
mov    0x2bd0(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    143d <traffic_saved_check+0x2bd>
lea    0xe24(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
jmp    146a <traffic_saved_check+0x2ea>
lea    0xe2c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13b8 <traffic_saved_check+0x238>
jmp    146f <traffic_saved_check+0x2ef>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<traffic_saved_check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
lea    0xf62(%rip),%rdi
call   1080 <access@plt>
cmp    $0xffffffff,%eax
je     1262 <traffic_saved_check+0xe2>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x14,%r14d
mov    %rsp,%r12
mov    0x2e0f(%rip),%r15
lea    0xe70(%rip),%r13
lea    0x8(%rsp),%rbx
lea    0xeb4(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe87(%rip),%rbp
nopl   0x0(%rax,%rax,1)
lea    0xf0a(%rip),%rdi
mov    %r12,%rsi
call   1050 <sqlite3_open@plt>
cmp    (%r15),%eax
je     1220 <traffic_saved_check+0xa0>
lea    0xfc2(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
mov    %r13,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1040 <sqlite3_exec@plt>
cmp    %eax,(%r15)
je     13cb <traffic_saved_check+0x24b>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
add    $0xffffffff,%r14d
jne    1200 <traffic_saved_check+0x80>
jmp    13de <traffic_saved_check+0x25e>
lea    0xf92(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1090 <sys_log@plt>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5d(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    $0x14,%r13d
mov    %rsp,%r15
mov    0x2d32(%rip),%r14
lea    0xd43(%rip),%r12
lea    0x8(%rsp),%rbp
lea    0xec4(%rip),%rbx
nopl   0x0(%rax)
lea    0xe3a(%rip),%rdi
mov    %r15,%rsi
call   1050 <sqlite3_open@plt>
cmp    (%r14),%eax
je     12f0 <traffic_saved_check+0x170>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbp,%r8
call   1040 <sqlite3_exec@plt>
cmp    %eax,(%r14)
je     132b <traffic_saved_check+0x1ab>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
add    $0xffffffff,%r13d
jne    12d0 <traffic_saved_check+0x150>
jmp    1340 <traffic_saved_check+0x1c0>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x14,%r15d
mov    %rsp,%r12
lea    0xcc8(%rip),%r13
lea    0x8(%rsp),%rbx
lea    0xe07(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xdd1(%rip),%rbp
nopl   0x0(%rax,%rax,1)
lea    0xd9a(%rip),%rdi
mov    %r12,%rsi
call   1050 <sqlite3_open@plt>
cmp    (%r14),%eax
je     1390 <traffic_saved_check+0x210>
lea    0xe52(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
mov    %r13,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1040 <sqlite3_exec@plt>
cmp    %eax,(%r14)
je     13cb <traffic_saved_check+0x24b>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
add    $0xffffffff,%r15d
jne    1370 <traffic_saved_check+0x1f0>
jmp    13de <traffic_saved_check+0x25e>
mov    0x10(%rsp),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1070 <sqlite3_close@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"/ailvgo/system/traffic/traffic_saved.db\00"
@W_OK = global i32 0
@.str.1 = [31 x i8] c"traffic_saved.db : not exist!\0A\00"
@.str.2 = [30 x i8] c"traffic_saved.db : not exist!\00"
@.str.3 = [27 x i8] c"traffic_saved.db : exist!\0A\00"
@.str.4 = [41 x i8] c"creat traffic_saved.db using traffic.db\0A\00"
@.str.5 = [81 x i8] c"cp -f /ailvgo/system/traffic/traffic.db /ailvgo/system/traffic/traffic_saved.db\0A\00"
@.str.6 = [80 x i8] c"cp -f /ailvgo/system/traffic/traffic.db /ailvgo/system/traffic/traffic_saved.db\00"
@SQLITE_OK = global i32 0
@.str.7 = [31 x i8] c"Cannot open traffic_saved.db!\0A\00"
@.str.8 = [24 x i8] c"DROP TABLE traffic_info\00"
@.str.9 = [41 x i8] c"drop table in traffic_saved.db success!\0A\00"
@.str.10 = [41 x i8] c"drop table in traffic_saved.db failure!\0A\00"
@.str.11 = [56 x i8] c"CREATE TABLE traffic_saved (traffic TEXT, time INTEGER)\00"
@.str.12 = [43 x i8] c"create table in traffic_saved.db success!\0A\00"
@.str.13 = [43 x i8] c"create table in traffic_saved.db failure!\0A\00"
@.str.14 = [21 x i8] c"vacuum traffic_saved\00"
@.str.15 = [34 x i8] c"vacumm traffic_saved.db success!\0A\00"
@.str.16 = [34 x i8] c"vacuum traffic_saved.db failure!\0A\00"
define void @traffic_saved_check() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32* null, i32** %3
store i8* null, i8** %4
store i32 0, i32* %5
%6 = load i32, i32* @W_OK
%7 = call i32 @access(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @sys_log(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %80
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 @system(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 @sleep(i32 1)
store i32 0, i32* %5
br label %22
22: ; preds = %49, %17
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 20
br i1 %24, label %25, label %50
25: ; preds = %22
%26 = call i32 @sqlite3_open(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32** %3)
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = load i32, i32* @SQLITE_OK
%29 = icmp ne i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %32
32: ; preds = %30, %25
%33 = load i32*, i32** %3
%34 = call i32 @sqlite3_exec(i32* %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32* null, i32* null, i8** %4)
store i32 %34, i32* %2
%35 = load i32, i32* @SQLITE_OK
%36 = load i32, i32* %2
%37 = icmp eq i32 %35, %36
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0))
%40 = load i32*, i32** %3
%41 = call i32 @sqlite3_close(i32* %40)
br label %50
42: ; preds = %32
%43 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0))
%44 = load i32*, i32** %3
%45 = call i32 @sqlite3_close(i32* %44)
%46 = call i32 @sleep(i32 1)
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %49
49: ; preds = %42
br label %22
50: ; preds = %38, %22
store i32 0, i32* %5
br label %51
51: ; preds = %78, %50
%52 = load i32, i32* %5
%53 = icmp slt i32 %52, 20
br i1 %53, label %54, label %79
54: ; preds = %51
%55 = call i32 @sqlite3_open(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32** %3)
store i32 %55, i32* %2
%56 = load i32, i32* %2
%57 = load i32, i32* @SQLITE_OK
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %61
59: ; preds = %54
%60 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %61
61: ; preds = %59, %54
%62 = load i32*, i32** %3
%63 = call i32 @sqlite3_exec(i32* %62, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), i32* null, i32* null, i8** %4)
store i32 %63, i32* %2
%64 = load i32, i32* @SQLITE_OK
%65 = load i32, i32* %2
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %71
67: ; preds = %61
%68 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0))
%69 = load i32*, i32** %3
%70 = call i32 @sqlite3_close(i32* %69)
br label %79
71: ; preds = %61
%72 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0))
%73 = load i32*, i32** %3
%74 = call i32 @sqlite3_close(i32* %73)
%75 = call i32 @sleep(i32 1)
%76 = load i32, i32* %5
%77 = add nsw i32 %76, 1
store i32 %77, i32* %5
br label %78
78: ; preds = %71
br label %51
79: ; preds = %67, %51
br label %110
80: ; preds = %14
store i32 0, i32* %5
br label %81
81: ; preds = %108, %80
%82 = load i32, i32* %5
%83 = icmp slt i32 %82, 20
br i1 %83, label %84, label %109
84: ; preds = %81
%85 = call i32 @sqlite3_open(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32** %3)
store i32 %85, i32* %2
%86 = load i32, i32* %2
%87 = load i32, i32* @SQLITE_OK
%88 = icmp ne i32 %86, %87
br i1 %88, label %89, label %91
89: ; preds = %84
%90 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %91
91: ; preds = %89, %84
%92 = load i32*, i32** %3
%93 = call i32 @sqlite3_exec(i32* %92, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i32* null, i32* null, i8** %4)
store i32 %93, i32* %2
%94 = load i32, i32* @SQLITE_OK
%95 = load i32, i32* %2
%96 = icmp eq i32 %94, %95
br i1 %96, label %97, label %101
97: ; preds = %91
%98 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0))
%99 = load i32*, i32** %3
%100 = call i32 @sqlite3_close(i32* %99)
br label %109
101: ; preds = %91
%102 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0))
%103 = load i32*, i32** %3
%104 = call i32 @sqlite3_close(i32* %103)
%105 = call i32 @sleep(i32 1)
%106 = load i32, i32* %5
%107 = add nsw i32 %106, 1
store i32 %107, i32* %5
br label %108
108: ; preds = %101
br label %81
109: ; preds = %97, %81
br label %110
110: ; preds = %109, %79
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"/ailvgo/system/traffic/traffic_saved.db\00"
@W_OK = global i32 0
@SQLITE_OK = global i32 0
@.str.8 = [24 x i8] c"DROP TABLE traffic_info\00"
@.str.11 = [56 x i8] c"CREATE TABLE traffic_saved (traffic TEXT, time INTEGER)\00"
@.str.14 = [21 x i8] c"vacuum traffic_saved\00"
@str = [26 x i8] c"traffic_saved.db : exist!\00"
@str.17 = [33 x i8] c"vacuum traffic_saved.db failure!\00"
@str.18 = [33 x i8] c"vacumm traffic_saved.db success!\00"
@str.20 = [40 x i8] c"creat traffic_saved.db using traffic.db\00"
@str.21 = [80 x i8] c"cp -f /ailvgo/system/traffic/traffic.db /ailvgo/system/traffic/traffic_saved.db\00"
@str.22 = [42 x i8] c"create table in traffic_saved.db failure!\00"
@str.23 = [42 x i8] c"create table in traffic_saved.db success!\00"
@str.25 = [40 x i8] c"drop table in traffic_saved.db failure!\00"
@str.26 = [40 x i8] c"drop table in traffic_saved.db success!\00"
@str.27 = [30 x i8] c"Cannot open traffic_saved.db!\00"
@str.28 = [30 x i8] c"traffic_saved.db : not exist!\00"
define void @traffic_saved_check() {
%1 = alloca i32*
%2 = alloca i8*
%3 = bitcast i32** %1 to i8*
store i32* null, i32** %1
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = load i32, i32* @W_OK
%6 = tail call i32 @access(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %60
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.28, i64 0, i64 0))
%12 = tail call i32 @sys_log(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.28, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.20, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.21, i64 0, i64 0))
%15 = tail call i32 @system(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @str.21, i64 0, i64 0))
%16 = tail call i32 @sleep(i32 1)
br label %17
17: ; preds = %10, %33
%18 = phi i32 [ 0, %10 ], [ %38, %33 ]
%19 = call i32 @sqlite3_open(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32** %1)
%20 = load i32, i32* @SQLITE_OK
%21 = icmp eq i32 %19, %20
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.27, i64 0, i64 0))
br label %24
24: ; preds = %22, %17
%25 = load i32*, i32** %1
%26 = call i32 @sqlite3_exec(i32* %25, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32* null, i32* null, i8** %2)
%27 = load i32, i32* @SQLITE_OK
%28 = icmp eq i32 %27, %26
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.26, i64 0, i64 0))
%31 = load i32*, i32** %1
%32 = call i32 @sqlite3_close(i32* %31)
br label %40
33: ; preds = %24
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.25, i64 0, i64 0))
%35 = load i32*, i32** %1
%36 = call i32 @sqlite3_close(i32* %35)
%37 = call i32 @sleep(i32 1)
%38 = add nuw nsw i32 %18, 1
%39 = icmp eq i32 %38, 20
br i1 %39, label %40, label %17
40: ; preds = %33, %29
br label %41
41: ; preds = %40, %53
%42 = phi i32 [ %58, %53 ], [ 0, %40 ]
%43 = call i32 @sqlite3_open(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32** %1)
%44 = load i32, i32* @SQLITE_OK
%45 = icmp eq i32 %43, %44
br i1 %45, label %48, label %46
46: ; preds = %41
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.27, i64 0, i64 0))
br label %48
48: ; preds = %46, %41
%49 = load i32*, i32** %1
%50 = call i32 @sqlite3_exec(i32* %49, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), i32* null, i32* null, i8** %2)
%51 = load i32, i32* @SQLITE_OK
%52 = icmp eq i32 %51, %50
br i1 %52, label %79, label %53
53: ; preds = %48
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.22, i64 0, i64 0))
%55 = load i32*, i32** %1
%56 = call i32 @sqlite3_close(i32* %55)
%57 = call i32 @sleep(i32 1)
%58 = add nuw nsw i32 %42, 1
%59 = icmp eq i32 %58, 20
br i1 %59, label %84, label %41
60: ; preds = %8, %72
%61 = phi i32 [ 0, %8 ], [ %77, %72 ]
%62 = call i32 @sqlite3_open(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32** %1)
%63 = load i32, i32* @SQLITE_OK
%64 = icmp eq i32 %62, %63
br i1 %64, label %67, label %65
65: ; preds = %60
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.27, i64 0, i64 0))
br label %67
67: ; preds = %65, %60
%68 = load i32*, i32** %1
%69 = call i32 @sqlite3_exec(i32* %68, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i32* null, i32* null, i8** %2)
%70 = load i32, i32* @SQLITE_OK
%71 = icmp eq i32 %70, %69
br i1 %71, label %79, label %72
72: ; preds = %67
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.17, i64 0, i64 0))
%74 = load i32*, i32** %1
%75 = call i32 @sqlite3_close(i32* %74)
%76 = call i32 @sleep(i32 1)
%77 = add nuw nsw i32 %61, 1
%78 = icmp eq i32 %77, 20
br i1 %78, label %84, label %60
79: ; preds = %67, %48
%80 = phi i8* [ getelementptr inbounds ([42 x i8], [42 x i8]* @str.23, i64 0, i64 0), %48 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.18, i64 0, i64 0), %67 ]
%81 = call i32 @puts(i8* dereferenceable(1) %80)
%82 = load i32*, i32** %1
%83 = call i32 @sqlite3_close(i32* %82)
br label %84
84: ; preds = %72, %53, %79
ret void
}