#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*/ str;
typedef int /*<<< orphan*/ sql;
typedef scalar_t__ my_ulonglong;
typedef char **MYSQL_ROW;
typedef int /*<<< orphan*/ MYSQL_RES;
typedef int /*<<< orphan*/ MYSQL;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
scalar_t__ mysql_affected_rows(int /*<<< orphan*/ *);
int /*<<< orphan*/ mysql_close(int /*<<< orphan*/ *);
char *mysql_error(int /*<<< orphan*/ *);
char **mysql_fetch_row(int /*<<< orphan*/ *);
unsigned int mysql_field_count(int /*<<< orphan*/ *);
int /*<<< orphan*/ mysql_free_result(int /*<<< orphan*/ *);
char *mysql_get_client_info();
unsigned long mysql_get_client_version();
char *mysql_get_host_info(int /*<<< orphan*/ *);
unsigned int mysql_get_proto_info(int /*<<< orphan*/ *);
char *mysql_get_server_info(int /*<<< orphan*/ *);
unsigned long mysql_get_server_version(int /*<<< orphan*/ *);
char *mysql_info(int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_init(int /*<<< orphan*/ *);
scalar_t__ mysql_insert_id(int /*<<< orphan*/ *);
int /*<<< orphan*/ mysql_library_end();
scalar_t__ mysql_library_init(int /*<<< orphan*/, int /*<<< orphan*/ *,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_list_dbs(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_list_tables(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
unsigned int mysql_num_fields(int /*<<< orphan*/ *);
scalar_t__ mysql_num_rows(int /*<<< orphan*/ *);
int mysql_ping(int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_real_connect(int /*<<< orphan*/ *, char const *,
                                       char const *, char const *, char const *,
                                       unsigned int, char const *,
                                       int /*<<< orphan*/);
int mysql_real_query(int /*<<< orphan*/ *, char *, int);
scalar_t__ mysql_select_db(int /*<<< orphan*/ *, char const *);
char *mysql_stat(int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_store_result(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char const *);
scalar_t__ strlen(char *);
int main() {
  MYSQL *mysql = NULL;
  const char *host = "localhost";
  const char *user = "root";
  const char *passwd = "root";
  const char *db = "fgap_config";
  unsigned int port = 3306;
  const char *unix_socket = "/var/run/mysqld/mysqld.sock";
  int flag = 0, i = 0;
  const char *db2 = "test";
  char sql[1024] = {0};
  if (mysql_library_init(0, NULL, NULL)) {
    fprintf(stderr, "could not initialize MySQL client library\n");
    exit(EXIT_FAILURE);
  }
  mysql = mysql_init(mysql);
  if (mysql == NULL) {
    perror("mysql_init error");
    return EXIT_FAILURE;
  }
  printf("mysql_init success\n");
  mysql =
      mysql_real_connect(mysql, host, user, passwd, db, port, unix_socket, 0);
  if (mysql == NULL) {
    fprintf(stderr, "Failed to connect to database: Error: %s\n",
            mysql_error(mysql));
    return EXIT_FAILURE;
  }
  printf("mysql_real_connect success\n");
  int ping = mysql_ping(mysql);
  if (ping == 0) {
    printf("mysql is active !\n");
  } else {
    return EXIT_FAILURE;
  }
  const char *clientInfo = mysql_get_client_info();
  printf("mysql_get_client_info : %s\n", clientInfo);
  unsigned long version = mysql_get_client_version();
  printf("mysql_get_client_version : %ld\n", version);
  const char *serverInfo = mysql_get_server_info(mysql);
  printf("mysql_get_server_info : %s\n", serverInfo);
  const char *hostInfo = mysql_get_host_info(mysql);
  printf("mysql_get_host_info : %s\n", hostInfo);
  unsigned int protoInfo = mysql_get_proto_info(mysql);
  printf("mysql_get_proto_info : %d\n", protoInfo);
  unsigned long serverVersion = mysql_get_server_version(mysql);
  printf("mysql_get_server_version : %ld\n", serverVersion);
  const char *mysqlInfo = mysql_info(mysql);
  printf("mysql_info : %s\n", mysqlInfo);
  const char *stat = mysql_stat(mysql);
  printf("mysql_stat : %s\n", stat);
  MYSQL_RES *pRes = mysql_list_dbs(mysql, NULL);
  MYSQL_ROW row = NULL;
  if (pRes) {
    unsigned int fields = mysql_num_fields(pRes);
    my_ulonglong rows = mysql_num_rows(pRes);
    unsigned int count = mysql_field_count(mysql);
    printf("mysql_num_fields : %d\n", fields);
    printf("mysql_num_rows : %ld\n", (long)rows);
    printf("mysql_field_count : %d\n", count);
    while ((row = mysql_fetch_row(pRes)) != NULL) {
      if (strcmp(row[fields - 1], db2) == 0) {
        flag = 1;
      }
      printf("database: %-10s\n", row[fields - 1]);
    }
    mysql_free_result(pRes);
  }
  if (flag == 0) {
    printf("no %s db -> %d\n", db2, flag);
  }
  if (mysql_select_db(mysql, db2) == 0) {
    printf("mysql_select_db(mysql, %s) success \n", db2);
    MYSQL_RES *tables = mysql_list_tables(mysql, NULL);
    unsigned int fields = mysql_num_fields(tables);
    my_ulonglong rows = mysql_num_rows(tables);
    printf("mysql_num_fields : %d\n", fields);
    printf("mysql_num_rows : %d\n", (int)rows);
    if (tables) {
      flag = 0;
      MYSQL_ROW fetchRow = NULL;
      while ((fetchRow = mysql_fetch_row(tables)) != NULL) {
        if (strcmp(fetchRow[fields - 1], "student") == 0)
          flag = 1;
        printf("table : %-10s\n", fetchRow[fields - 1]);
      }
      if (!flag) {
        FILE *file = NULL;
        file = fopen("student.sql", "r");
        if (file) {
          while (!feof(file)) {
            char str[64] = {0};
            fgets(str, sizeof(str), file);
            strcat(sql, str);
          }
          printf("%s\n", sql);
        } else {
          fprintf(stderr, "fopen student.sql error\n");
          exit(EXIT_FAILURE);
        }
        fclose(file);
        int r = mysql_real_query(mysql, sql, (unsigned long)strlen(sql));
        if (r == 0) {
          printf("table student was created success !! \n");
        } else {
          printf("table student was created error !! \n");
          exit(EXIT_FAILURE);
        }
      } else {
        printf("table student already exists !! \n");
      }
    } else {
      printf("something wrong\n");
    }
  }
  memset(sql, 0, sizeof(sql));
  sprintf(sql, "select count(id) from student");
  int count = 0;
  if (mysql_real_query(mysql, sql, (unsigned int)strlen(sql)) == 0) {
    MYSQL_RES *result = mysql_store_result(mysql);
    unsigned int fields = mysql_num_fields(result);
    MYSQL_ROW fetchRow = mysql_fetch_row(result);
    count = atoi(fetchRow[fields - 1]);
    printf("count %d\n", count);
    mysql_free_result(result);
  }
  if (count < 50) {
    memset(sql, 0, sizeof(sql));
    for (i = 0; i < 10; ++i) {
      char name[16] = {0};
      char address[64] = {0};
      sprintf(name, "zing-%d", i);
      sprintf(address, "jiangsu-wuxi-%d", i);
      sprintf(sql,
              "INSERT INTO `student` (`name`,`age`,`address`) "
              "VALUES('%s','%d','%s')",
              name, 10 + i, address);
      if (mysql_real_query(mysql, sql, (unsigned int)strlen(sql)) == 0) {
        my_ulonglong id = mysql_insert_id(mysql);
        printf("insert num %ld success\n", (long int)id);
      }
    }
  }
  memset(sql, 0, sizeof(sql));
  sprintf(sql, "select * from student order by id asc limit 0,20");
  if (mysql_real_query(mysql, sql, (unsigned int)strlen(sql)) == 0) {
    MYSQL_RES *result = mysql_store_result(mysql);
    unsigned int fields = mysql_num_fields(result);
    printf("fields %d\n", fields);
    MYSQL_ROW fetchRow;
    while ((fetchRow = mysql_fetch_row(result)) != NULL) {
      printf("id:%s name:%s age:%s address:%s \n", fetchRow[0], fetchRow[1],
             fetchRow[2], fetchRow[3]);
    }
    mysql_free_result(result);
  }
  memset(sql, 0, sizeof(sql));
  sprintf(sql,
          "update student set name='%s',age=%d,address='%s' where id between "
          "%d and %d;",
          "zhangrongxiang", 24, "jiangsu-xuzhou-1", 1, 10);
  if (mysql_real_query(mysql, sql, (int)strlen(sql)) == 0) {
    printf("mysql_affected_rows : %d\n", (int)mysql_affected_rows(mysql));
  }
  mysql_close(mysql);
  mysql_library_end();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x630,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xc4f(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xc4e(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xc43(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xc3d(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0xcea,-0x34(%rbp)
lea    0xc37(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
lea    0xc3a(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10e0 <memset@plt>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1200 <mysql_library_init@plt>
cmp    $0x0,%rax
je     1451 <main+0xc1>
mov    0x2bad(%rip),%rax
mov    (%rax),%edi
lea    0xc00(%rip),%rsi
mov    $0x0,%al
call   1140 <fprintf@plt>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
call   1290 <exit@plt>
mov    -0x10(%rbp),%rdi
call   11c0 <mysql_init@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1486 <main+0xf6>
lea    0xbf7(%rip),%rdi
call   1220 <perror@plt>
mov    0x2b5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1e63 <main+0xad3>
lea    0xbeb(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x34(%rbp),%r9d
mov    -0x40(%rbp),%rax
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1190 <mysql_real_connect@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1513 <main+0x183>
mov    0x2b06(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c4(%rbp)
mov    -0x10(%rbp),%rdi
call   1250 <mysql_error@plt>
mov    -0x5c4(%rbp),%edi
mov    %rax,%rdx
lea    0xb91(%rip),%rsi
mov    $0x0,%al
call   1140 <fprintf@plt>
mov    0x2acf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1e63 <main+0xad3>
lea    0xb9c(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <mysql_ping@plt>
mov    %eax,-0x454(%rbp)
cmpl   $0x0,-0x454(%rbp)
jne    1550 <main+0x1c0>
lea    0xb8e(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1561 <main+0x1d1>
mov    0x2a81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1e63 <main+0xad3>
mov    $0x0,%al
call   1130 <mysql_get_client_info@plt>
mov    %rax,-0x460(%rbp)
mov    -0x460(%rbp),%rsi
lea    0xb68(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    $0x0,%al
call   1100 <mysql_get_client_version@plt>
mov    %rax,-0x468(%rbp)
mov    -0x468(%rbp),%rsi
lea    0xb61(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1170 <mysql_get_server_info@plt>
mov    %rax,-0x470(%rbp)
mov    -0x470(%rbp),%rsi
lea    0xb5c(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <mysql_get_host_info@plt>
mov    %rax,-0x478(%rbp)
mov    -0x478(%rbp),%rsi
lea    0xb53(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <mysql_get_proto_info@plt>
mov    %eax,-0x47c(%rbp)
mov    -0x47c(%rbp),%esi
lea    0xb4a(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <mysql_get_server_version@plt>
mov    %rax,-0x488(%rbp)
mov    -0x488(%rbp),%rsi
lea    0xb40(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10f0 <mysql_info@plt>
mov    %rax,-0x490(%rbp)
mov    -0x490(%rbp),%rsi
lea    0xb3b(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1240 <mysql_stat@plt>
mov    %rax,-0x498(%rbp)
mov    -0x498(%rbp),%rsi
lea    0xb27(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10c0 <mysql_list_dbs@plt>
mov    %rax,-0x4a0(%rbp)
movq   $0x0,-0x4a8(%rbp)
cmpq   $0x0,-0x4a0(%rbp)
je     17a3 <main+0x413>
mov    -0x4a0(%rbp),%rdi
call   1080 <mysql_num_fields@plt>
mov    %eax,-0x4ac(%rbp)
mov    -0x4a0(%rbp),%rdi
call   12a0 <mysql_num_rows@plt>
mov    %rax,-0x4b8(%rbp)
mov    -0x10(%rbp),%rdi
call   11d0 <mysql_field_count@plt>
mov    %eax,-0x4bc(%rbp)
mov    -0x4ac(%rbp),%esi
lea    0xac3(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x4b8(%rbp),%rsi
lea    0xac5(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x4bc(%rbp),%esi
lea    0xac7(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x4a0(%rbp),%rdi
call   1060 <mysql_fetch_row@plt>
mov    %rax,-0x4a8(%rbp)
cmp    $0x0,%rax
je     1797 <main+0x407>
mov    -0x4a8(%rbp),%rax
mov    -0x4ac(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rdi
mov    -0x50(%rbp),%rsi
call   1120 <strcmp@plt>
cmp    $0x0,%rax
jne    176e <main+0x3de>
movl   $0x1,-0x44(%rbp)
mov    -0x4a8(%rbp),%rax
mov    -0x4ac(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rsi
lea    0xa6e(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1721 <main+0x391>
mov    -0x4a0(%rbp),%rdi
call   11e0 <mysql_free_result@plt>
cmpl   $0x0,-0x44(%rbp)
jne    17c2 <main+0x432>
mov    -0x50(%rbp),%rsi
mov    -0x44(%rbp),%edx
lea    0xa4f(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   11b0 <mysql_select_db@plt>
cmp    $0x0,%rax
jne    1a80 <main+0x6f0>
mov    -0x50(%rbp),%rsi
lea    0xa36(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1160 <mysql_list_tables@plt>
mov    %rax,-0x4c8(%rbp)
mov    -0x4c8(%rbp),%rdi
call   1080 <mysql_num_fields@plt>
mov    %eax,-0x4cc(%rbp)
mov    -0x4c8(%rbp),%rdi
call   12a0 <mysql_num_rows@plt>
mov    %rax,-0x4d8(%rbp)
mov    -0x4cc(%rbp),%esi
lea    0x983(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x4d8(%rbp),%rax
mov    %eax,%esi
lea    0x9f7(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
cmpq   $0x0,-0x4c8(%rbp)
je     1a6d <main+0x6dd>
movl   $0x0,-0x44(%rbp)
movq   $0x0,-0x4e0(%rbp)
mov    -0x4c8(%rbp),%rdi
call   1060 <mysql_fetch_row@plt>
mov    %rax,-0x4e0(%rbp)
cmp    $0x0,%rax
je     18e8 <main+0x558>
mov    -0x4e0(%rbp),%rax
mov    -0x4cc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rdi
lea    0xa74(%rip),%rsi
call   1120 <strcmp@plt>
cmp    $0x0,%rax
jne    18bf <main+0x52f>
movl   $0x1,-0x44(%rbp)
mov    -0x4e0(%rbp),%rax
mov    -0x4cc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rsi
lea    0x978(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    186f <main+0x4df>
cmpl   $0x0,-0x44(%rbp)
jne    1a5a <main+0x6ca>
movq   $0x0,-0x4e8(%rbp)
lea    0x95f(%rip),%rdi
lea    0x76b(%rip),%rsi
call   1210 <fopen@plt>
mov    %rax,-0x4e8(%rbp)
cmpq   $0x0,-0x4e8(%rbp)
je     19a8 <main+0x618>
jmp    192a <main+0x59a>
mov    -0x4e8(%rbp),%rdi
call   1150 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    194b <main+0x5bb>
jmp    198e <main+0x5fe>
lea    -0x530(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   10e0 <memset@plt>
lea    -0x530(%rbp),%rdi
mov    -0x4e8(%rbp),%rdx
mov    $0x40,%esi
call   1110 <fgets@plt>
lea    -0x450(%rbp),%rdi
lea    -0x530(%rbp),%rsi
call   1270 <strcat@plt>
jmp    192a <main+0x59a>
lea    -0x450(%rbp),%rsi
lea    0x803(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    19cd <main+0x63d>
mov    0x2631(%rip),%rax
mov    (%rax),%edi
lea    0x8b7(%rip),%rsi
mov    $0x0,%al
call   1140 <fprintf@plt>
mov    0x2612(%rip),%rax
mov    (%rax),%edi
call   1290 <exit@plt>
mov    -0x4e8(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x5d8(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x5d0(%rbp)
lea    -0x450(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x5d8(%rbp),%rdi
mov    -0x5d0(%rbp),%rsi
mov    %eax,%edx
call   11f0 <mysql_real_query@plt>
mov    %eax,-0x534(%rbp)
cmpl   $0x0,-0x534(%rbp)
jne    1a39 <main+0x6a9>
lea    0x85b(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1a55 <main+0x6c5>
lea    0x86f(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    0x258a(%rip),%rax
mov    (%rax),%edi
call   1290 <exit@plt>
jmp    1a68 <main+0x6d8>
lea    0x873(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1a7b <main+0x6eb>
lea    0x882(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1a80 <main+0x6f0>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10e0 <memset@plt>
lea    -0x450(%rbp),%rdi
lea    0x866(%rip),%rsi
mov    $0x0,%al
call   1280 <sprintf@plt>
movl   $0x0,-0x538(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x5e8(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x5e0(%rbp)
lea    -0x450(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x5e8(%rbp),%rdi
mov    -0x5e0(%rbp),%rsi
mov    %eax,%edx
call   11f0 <mysql_real_query@plt>
cmp    $0x0,%eax
jne    1b6b <main+0x7db>
mov    -0x10(%rbp),%rdi
call   12b0 <mysql_store_result@plt>
mov    %rax,-0x540(%rbp)
mov    -0x540(%rbp),%rdi
call   1080 <mysql_num_fields@plt>
mov    %eax,-0x544(%rbp)
mov    -0x540(%rbp),%rdi
call   1060 <mysql_fetch_row@plt>
mov    %rax,-0x550(%rbp)
mov    -0x550(%rbp),%rax
mov    -0x544(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rdi
call   1260 <atoi@plt>
mov    %eax,-0x538(%rbp)
mov    -0x538(%rbp),%esi
lea    0x7cd(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x540(%rbp),%rdi
call   11e0 <mysql_free_result@plt>
cmpl   $0x32,-0x538(%rbp)
jge    1c9b <main+0x90b>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10e0 <memset@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    1c96 <main+0x906>
lea    -0x560(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10e0 <memset@plt>
lea    -0x5a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   10e0 <memset@plt>
lea    -0x560(%rbp),%rdi
mov    -0x48(%rbp),%edx
lea    0x75c(%rip),%rsi
mov    $0x0,%al
call   1280 <sprintf@plt>
lea    -0x5a0(%rbp),%rdi
mov    -0x48(%rbp),%edx
lea    0x74c(%rip),%rsi
mov    $0x0,%al
call   1280 <sprintf@plt>
lea    -0x450(%rbp),%rdi
lea    -0x560(%rbp),%rdx
mov    -0x48(%rbp),%ecx
add    $0xa,%ecx
lea    -0x5a0(%rbp),%r8
lea    0x733(%rip),%rsi
mov    $0x0,%al
call   1280 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x5f8(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x5f0(%rbp)
lea    -0x450(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x5f8(%rbp),%rdi
mov    -0x5f0(%rbp),%rsi
mov    %eax,%edx
call   11f0 <mysql_real_query@plt>
cmp    $0x0,%eax
jne    1c83 <main+0x8f3>
mov    -0x10(%rbp),%rdi
call   1230 <mysql_insert_id@plt>
mov    %rax,-0x5a8(%rbp)
mov    -0x5a8(%rbp),%rsi
lea    0x711(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1c88 <main+0x8f8>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1b92 <main+0x802>
jmp    1c9b <main+0x90b>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10e0 <memset@plt>
lea    -0x450(%rbp),%rdi
lea    0x6e9(%rip),%rsi
mov    $0x0,%al
call   1280 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x608(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x600(%rbp)
lea    -0x450(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x608(%rbp),%rdi
mov    -0x600(%rbp),%rsi
mov    %eax,%edx
call   11f0 <mysql_real_query@plt>
cmp    $0x0,%eax
jne    1da3 <main+0xa13>
mov    -0x10(%rbp),%rdi
call   12b0 <mysql_store_result@plt>
mov    %rax,-0x5b0(%rbp)
mov    -0x5b0(%rbp),%rdi
call   1080 <mysql_num_fields@plt>
mov    %eax,-0x5b4(%rbp)
mov    -0x5b4(%rbp),%esi
lea    0x6a1(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x5b0(%rbp),%rdi
call   1060 <mysql_fetch_row@plt>
mov    %rax,-0x5c0(%rbp)
cmp    $0x0,%rax
je     1d97 <main+0xa07>
mov    -0x5c0(%rbp),%rax
mov    (%rax),%rsi
mov    -0x5c0(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x5c0(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x5c0(%rbp),%rax
mov    0x18(%rax),%r8
lea    0x656(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1d3c <main+0x9ac>
mov    -0x5b0(%rbp),%rdi
call   11e0 <mysql_free_result@plt>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10e0 <memset@plt>
lea    -0x450(%rbp),%rdi
lea    0x63f(%rip),%rsi
lea    0x685(%rip),%rdx
mov    $0x18,%ecx
lea    0x688(%rip),%r8
mov    $0x1,%r9d
movl   $0xa,(%rsp)
mov    $0x0,%al
call   1280 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x618(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x610(%rbp)
lea    -0x450(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x618(%rbp),%rdi
mov    -0x610(%rbp),%rsi
mov    %eax,%edx
call   11f0 <mysql_real_query@plt>
cmp    $0x0,%eax
jne    1e47 <main+0xab7>
mov    -0x10(%rbp),%rdi
call   1180 <mysql_affected_rows@plt>
mov    %eax,%esi
lea    0x630(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x10(%rbp),%rdi
call   11a0 <mysql_close@plt>
mov    $0x0,%al
call   10d0 <mysql_library_end@plt>
mov    0x2172(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x630,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x468,%rsp
lea    0x60(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   10f0 <memset@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1210 <mysql_library_init@plt>
test   %rax,%rax
jne    1b11 <main+0x771>
xor    %edi,%edi
call   11d0 <mysql_init@plt>
test   %rax,%rax
je     163a <main+0x29a>
mov    %rax,%rbx
lea    0xfd8(%rip),%rdi
call   1060 <puts@plt>
lea    0xc1f(%rip),%rax
lea    0xbfd(%rip),%rsi
lea    0xc00(%rip),%rcx
lea    0xbfe(%rip),%r8
mov    %rbx,%rdi
mov    %rcx,%rdx
mov    $0xcea,%r9d
push   $0x0
push   %rax
call   11a0 <mysql_real_connect@plt>
add    $0x10,%rsp
test   %rax,%rax
je     1455 <main+0xb5>
mov    %rax,%r12
lea    0xfa3(%rip),%rdi
call   1060 <puts@plt>
mov    %r12,%rdi
call   1030 <mysql_ping@plt>
test   %eax,%eax
je     1484 <main+0xe4>
mov    0x2b88(%rip),%rax
jmp    1afd <main+0x75d>
mov    0x2b84(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   1260 <mysql_error@plt>
lea    0xc0c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1150 <fprintf@plt>
mov    0x2b59(%rip),%rax
jmp    1afd <main+0x75d>
lea    0xf6b(%rip),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
call   1140 <mysql_get_client_info@plt>
lea    0xc04(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
xor    %eax,%eax
call   1110 <mysql_get_client_version@plt>
lea    0xc08(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
call   1180 <mysql_get_server_info@plt>
lea    0xc0f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
call   1040 <mysql_get_host_info@plt>
lea    0xc12(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
call   10b0 <mysql_get_proto_info@plt>
lea    0xc13(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
call   1050 <mysql_get_server_version@plt>
lea    0xc16(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
call   1100 <mysql_info@plt>
lea    0xc1d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
call   1250 <mysql_stat@plt>
lea    0xc15(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
call   10d0 <mysql_list_dbs@plt>
test   %rax,%rax
je     165a <main+0x2ba>
mov    %rax,%r15
mov    %rax,%rdi
call   1090 <mysql_num_fields@plt>
mov    %eax,%r13d
mov    %r15,%rdi
call   12b0 <mysql_num_rows@plt>
mov    %rax,%rbp
mov    %r12,%rdi
call   11e0 <mysql_field_count@plt>
mov    %eax,%r14d
lea    0xbde(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0xbe4(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0xbe9(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r15,%rdi
call   1070 <mysql_fetch_row@plt>
test   %rax,%rax
je     1652 <main+0x2b2>
mov    %rax,%rbp
mov    %r12,0x8(%rsp)
add    $0xffffffff,%r13d
mov    $0x1,%r14d
lea    0xbcd(%rip),%r12
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r13,8),%rdi
lea    0xa3b(%rip),%rsi
call   1130 <strcmp@plt>
test   %rax,%rax
cmove  %r14d,%ebx
mov    0x0(%rbp,%r13,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r15,%rdi
call   1070 <mysql_fetch_row@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    15f0 <main+0x250>
mov    %r15,%rdi
call   11f0 <mysql_free_result@plt>
test   %ebx,%ebx
mov    0x8(%rsp),%r12
jne    1671 <main+0x2d1>
jmp    165a <main+0x2ba>
lea    0xa26(%rip),%rdi
call   1230 <perror@plt>
mov    0x298b(%rip),%rax
jmp    1afd <main+0x75d>
mov    %r15,%rdi
call   11f0 <mysql_free_result@plt>
lea    0xb66(%rip),%rdi
lea    0x9cf(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0x9bf(%rip),%rsi
mov    %r12,%rdi
call   11c0 <mysql_select_db@plt>
test   %rax,%rax
jne    1835 <main+0x495>
lea    0xb47(%rip),%rdi
lea    0x9a0(%rip),%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
call   1170 <mysql_list_tables@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1090 <mysql_num_fields@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   12b0 <mysql_num_rows@plt>
mov    %rax,%rbp
lea    0xaaa(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0xb25(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
test   %r15,%r15
je     1829 <main+0x489>
mov    %r15,%rdi
call   1070 <mysql_fetch_row@plt>
test   %rax,%rax
je     176d <main+0x3cd>
mov    %rax,%rbp
mov    %r12,0x8(%rsp)
add    $0xffffffff,%ebx
mov    $0x1,%r13d
lea    0xb03(%rip),%r12
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,8),%rdi
lea    0xb2f(%rip),%rsi
call   1130 <strcmp@plt>
test   %rax,%rax
cmove  %r13d,%r14d
mov    0x0(%rbp,%rbx,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r15,%rdi
call   1070 <mysql_fetch_row@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1720 <main+0x380>
test   %r14d,%r14d
mov    0x8(%rsp),%r12
je     176d <main+0x3cd>
lea    0xcfa(%rip),%rdi
jmp    1830 <main+0x490>
lea    0xaac(%rip),%rdi
lea    0x8fb(%rip),%rsi
call   1220 <fopen@plt>
test   %rax,%rax
je     1b36 <main+0x796>
mov    %rax,%rbx
mov    %rax,%rdi
call   1160 <feof@plt>
test   %eax,%eax
jne    17ee <main+0x44e>
lea    0x10(%rsp),%rbp
lea    0x60(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
mov    %rbp,%rdi
mov    $0x40,%esi
mov    %rbx,%rdx
call   1120 <fgets@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1280 <strcat@plt>
mov    %rbx,%rdi
call   1160 <feof@plt>
test   %eax,%eax
je     17b0 <main+0x410>
lea    0x60(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <puts@plt>
mov    %rbx,%rdi
call   1080 <fclose@plt>
mov    %rbp,%rdi
call   10a0 <strlen@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1200 <mysql_real_query@plt>
test   %eax,%eax
jne    1b48 <main+0x7a8>
lea    0xc15(%rip),%rdi
jmp    1830 <main+0x490>
lea    0xbd8(%rip),%rdi
call   1060 <puts@plt>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10f0 <memset@plt>
movups 0x9f5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movups 0x9f7(%rip),%xmm0
movups %xmm0,0x6e(%rsp)
mov    %rbx,%rdi
call   10a0 <strlen@plt>
mov    %r12,%r13
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1200 <mysql_real_query@plt>
test   %eax,%eax
jne    18c9 <main+0x529>
mov    %r13,%rdi
call   12c0 <mysql_store_result@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <mysql_num_fields@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <mysql_fetch_row@plt>
add    $0xffffffff,%ebp
mov    (%rax,%rbp,8),%rdi
call   1270 <atoi@plt>
mov    %eax,%ebp
lea    0x9b4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %rbx,%rdi
call   11f0 <mysql_free_result@plt>
cmp    $0x31,%ebp
jg     19a7 <main+0x607>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10f0 <memset@plt>
lea    0x50(%rsp),%r12
lea    0x10(%rsp),%rbp
lea    0x997(%rip),%r14
xor    %r15d,%r15d
jmp    190e <main+0x56e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xfffffff7,%r15d
cmp    $0xa,%r15d
je     19a7 <main+0x607>
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
mov    %r12,%rdi
lea    0x939(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1290 <sprintf@plt>
mov    %rbp,%rdi
lea    0x92d(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1290 <sprintf@plt>
add    $0xa,%r15d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %rbp,%r8
xor    %eax,%eax
call   1290 <sprintf@plt>
mov    %rbx,%rdi
call   10a0 <strlen@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1200 <mysql_real_query@plt>
test   %eax,%eax
jne    1900 <main+0x560>
mov    %r13,%rdi
call   1240 <mysql_insert_id@plt>
lea    0x933(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
jmp    1900 <main+0x560>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10f0 <memset@plt>
movups 0x921(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movups 0x925(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movups 0x929(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movb   $0x0,0x90(%rsp)
mov    %rbx,%rdi
call   10a0 <strlen@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1200 <mysql_real_query@plt>
test   %eax,%eax
jne    1a6e <main+0x6ce>
mov    %r13,%rdi
call   12c0 <mysql_store_result@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <mysql_num_fields@plt>
lea    0x8f7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %rbx,%rdi
call   1070 <mysql_fetch_row@plt>
test   %rax,%rax
je     1a66 <main+0x6c6>
lea    0x8e5(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    (%rax),%rsi
mov    0x8(%rax),%rdx
mov    0x10(%rax),%rcx
mov    0x18(%rax),%r8
mov    %rbp,%rdi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %rbx,%rdi
call   1070 <mysql_fetch_row@plt>
test   %rax,%rax
jne    1a40 <main+0x6a0>
mov    %rbx,%rdi
call   11f0 <mysql_free_result@plt>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10f0 <memset@plt>
sub    $0x8,%rsp
lea    0x8b4(%rip),%rsi
lea    0x8fa(%rip),%rdx
lea    0x902(%rip),%r8
mov    %rbx,%rdi
mov    $0x18,%ecx
mov    $0x1,%r9d
xor    %eax,%eax
push   $0xa
call   1290 <sprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   10a0 <strlen@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1200 <mysql_real_query@plt>
test   %eax,%eax
jne    1ae7 <main+0x747>
mov    %r13,%rdi
call   1190 <mysql_affected_rows@plt>
lea    0x8d0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r13,%rdi
call   11b0 <mysql_close@plt>
xor    %eax,%eax
call   10e0 <mysql_library_end@plt>
mov    0x24d3(%rip),%rax
mov    (%rax),%eax
add    $0x468,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x24c8(%rip),%rax
mov    (%rax),%edi
lea    0x51b(%rip),%rsi
xor    %eax,%eax
call   1150 <fprintf@plt>
mov    0x24a9(%rip),%rax
mov    (%rax),%edi
call   12a0 <exit@plt>
mov    0x24a3(%rip),%rax
mov    (%rax),%edi
lea    0x6e6(%rip),%rsi
jmp    1b21 <main+0x781>
lea    0x8c9(%rip),%rdi
call   1060 <puts@plt>
jmp    1b28 <main+0x788>

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"root\00"
@.str.2 = [12 x i8] c"fgap_config\00"
@.str.3 = [28 x i8] c"/var/run/mysqld/mysqld.sock\00"
@.str.4 = [5 x i8] c"test\00"
@stderr = global i32 0
@.str.5 = [43 x i8] c"could not initialize MySQL client library\0A\00"
@EXIT_FAILURE = global i32 0
@.str.6 = [17 x i8] c"mysql_init error\00"
@.str.7 = [20 x i8] c"mysql_init success\0A\00"
@.str.8 = [42 x i8] c"Failed to connect to database: Error: %s\0A\00"
@.str.9 = [28 x i8] c"mysql_real_connect success\0A\00"
@.str.10 = [19 x i8] c"mysql is active !\0A\00"
@.str.11 = [28 x i8] c"mysql_get_client_info : %s\0A\00"
@.str.12 = [32 x i8] c"mysql_get_client_version : %ld\0A\00"
@.str.13 = [28 x i8] c"mysql_get_server_info : %s\0A\00"
@.str.14 = [26 x i8] c"mysql_get_host_info : %s\0A\00"
@.str.15 = [27 x i8] c"mysql_get_proto_info : %d\0A\00"
@.str.16 = [32 x i8] c"mysql_get_server_version : %ld\0A\00"
@.str.17 = [17 x i8] c"mysql_info : %s\0A\00"
@.str.18 = [17 x i8] c"mysql_stat : %s\0A\00"
@.str.19 = [23 x i8] c"mysql_num_fields : %d\0A\00"
@.str.20 = [22 x i8] c"mysql_num_rows : %ld\0A\00"
@.str.21 = [24 x i8] c"mysql_field_count : %d\0A\00"
@.str.22 = [17 x i8] c"database: %-10s\0A\00"
@.str.23 = [16 x i8] c"no %s db -> %d\0A\00"
@.str.24 = [37 x i8] c"mysql_select_db(mysql, %s) success \0A\00"
@.str.25 = [21 x i8] c"mysql_num_rows : %d\0A\00"
@.str.26 = [8 x i8] c"student\00"
@.str.27 = [15 x i8] c"table : %-10s\0A\00"
@.str.28 = [12 x i8] c"student.sql\00"
@.str.29 = [2 x i8] c"r\00"
@.str.30 = [4 x i8] c"%s\0A\00"
@.str.31 = [25 x i8] c"fopen student.sql error\0A\00"
@.str.32 = [39 x i8] c"table student was created success !! \0A\00"
@.str.33 = [37 x i8] c"table student was created error !! \0A\00"
@.str.34 = [34 x i8] c"table student already exists !! \0A\00"
@.str.35 = [17 x i8] c"something wrong\0A\00"
@.str.36 = [30 x i8] c"select count(id) from student\00"
@.str.37 = [10 x i8] c"count %d\0A\00"
@.str.38 = [8 x i8] c"zing-%d\00"
@.str.39 = [16 x i8] c"jiangsu-wuxi-%d\00"
@.str.40 = [70 x i8] c"INSERT INTO `student` (`name`,`age`,`address`) VALUES('%s','%d','%s')\00"
@.str.41 = [24 x i8] c"insert num %ld success\0A\00"
@.str.42 = [49 x i8] c"select * from student order by id asc limit 0,20\00"
@.str.43 = [11 x i8] c"fields %d\0A\00"
@.str.44 = [34 x i8] c"id:%s name:%s age:%s address:%s \0A\00"
@.str.45 = [77 x i8] c"update student set name='%s',age=%d,address='%s' where id between %d and %d;\00"
@.str.46 = [15 x i8] c"zhangrongxiang\00"
@.str.47 = [17 x i8] c"jiangsu-xuzhou-1\00"
@.str.48 = [26 x i8] c"mysql_affected_rows : %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca [1024 x i8]
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i64
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i32*
%23 = alloca i8**
%24 = alloca i32
%25 = alloca i64
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i32
%29 = alloca i64
%30 = alloca i8**
%31 = alloca i32*
%32 = alloca [64 x i8]
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32*
%36 = alloca i32
%37 = alloca i8**
%38 = alloca [16 x i8]
%39 = alloca [64 x i8]
%40 = alloca i64
%41 = alloca i32*
%42 = alloca i32
%43 = alloca i8**
store i32 0, i32* %1
store i32* null, i32** %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %6
store i32 3306, i32* %7
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8** %8
store i32 0, i32* %9
store i32 0, i32* %10
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %11
%44 = bitcast [1024 x i8]* %12 to i8*
%45 = call i64 @mysql_library_init(i32 0, i32* null, i32* null)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %0
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %0
%53 = load i32*, i32** %2
%54 = call i32* @mysql_init(i32* %53)
store i32* %54, i32** %2
%55 = load i32*, i32** %2
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%59 = load i32, i32* @EXIT_FAILURE
store i32 %59, i32* %1
br label %399
60: ; preds = %52
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%62 = load i32*, i32** %2
%63 = load i8*, i8** %3
%64 = load i8*, i8** %4
%65 = load i8*, i8** %5
%66 = load i8*, i8** %6
%67 = load i32, i32* %7
%68 = load i8*, i8** %8
%69 = call i32* @mysql_real_connect(i32* %62, i8* %63, i8* %64, i8* %65, i8* %66, i32 %67, i8* %68, i32 0)
store i32* %69, i32** %2
%70 = load i32*, i32** %2
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %78
72: ; preds = %60
%73 = load i32, i32* @stderr
%74 = load i32*, i32** %2
%75 = call i8* @mysql_error(i32* %74)
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i8* %75)
%77 = load i32, i32* @EXIT_FAILURE
store i32 %77, i32* %1
br label %399
78: ; preds = %60
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%80 = load i32*, i32** %2
%81 = call i32 @mysql_ping(i32* %80)
store i32 %81, i32* %13
%82 = load i32, i32* %13
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %78
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %88
86: ; preds = %78
%87 = load i32, i32* @EXIT_FAILURE
store i32 %87, i32* %1
br label %399
88: ; preds = %84
%89 = call i8* (...) @mysql_get_client_info()
store i8* %89, i8** %14
%90 = load i8*, i8** %14
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i8* %90)
%92 = call i64 (...) @mysql_get_client_version()
store i64 %92, i64* %15
%93 = load i64, i64* %15
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i64 %93)
%95 = load i32*, i32** %2
%96 = call i8* @mysql_get_server_info(i32* %95)
store i8* %96, i8** %16
%97 = load i8*, i8** %16
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %97)
%99 = load i32*, i32** %2
%100 = call i8* @mysql_get_host_info(i32* %99)
store i8* %100, i8** %17
%101 = load i8*, i8** %17
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %101)
%103 = load i32*, i32** %2
%104 = call i32 @mysql_get_proto_info(i32* %103)
store i32 %104, i32* %18
%105 = load i32, i32* %18
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i32 %105)
%107 = load i32*, i32** %2
%108 = call i64 @mysql_get_server_version(i32* %107)
store i64 %108, i64* %19
%109 = load i64, i64* %19
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0), i64 %109)
%111 = load i32*, i32** %2
%112 = call i8* @mysql_info(i32* %111)
store i8* %112, i8** %20
%113 = load i8*, i8** %20
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i8* %113)
%115 = load i32*, i32** %2
%116 = call i8* @mysql_stat(i32* %115)
store i8* %116, i8** %21
%117 = load i8*, i8** %21
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i8* %117)
%119 = load i32*, i32** %2
%120 = call i32* @mysql_list_dbs(i32* %119, i32* null)
store i32* %120, i32** %22
store i8** null, i8*** %23
%121 = load i32*, i32** %22
%122 = icmp ne i32* %121, null
br i1 %122, label %123, label %162
123: ; preds = %88
%124 = load i32*, i32** %22
%125 = call i32 @mysql_num_fields(i32* %124)
store i32 %125, i32* %24
%126 = load i32*, i32** %22
%127 = call i64 @mysql_num_rows(i32* %126)
store i64 %127, i64* %25
%128 = load i32*, i32** %2
%129 = call i32 @mysql_field_count(i32* %128)
store i32 %129, i32* %26
%130 = load i32, i32* %24
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i32 %130)
%132 = load i64, i64* %25
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i64 %132)
%134 = load i32, i32* %26
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.21, i64 0, i64 0), i32 %134)
br label %136
136: ; preds = %151, %123
%137 = load i32*, i32** %22
%138 = call i8** @mysql_fetch_row(i32* %137)
store i8** %138, i8*** %23
%139 = icmp ne i8** %138, null
br i1 %139, label %140, label %159
140: ; preds = %136
%141 = load i8**, i8*** %23
%142 = load i32, i32* %24
%143 = sub i32 %142, 1
%144 = zext i32 %143 to i64
%145 = getelementptr inbounds i8*, i8** %141, i64 %144
%146 = load i8*, i8** %145
%147 = load i8*, i8** %11
%148 = call i64 @strcmp(i8* %146, i8* %147)
%149 = icmp eq i64 %148, 0
br i1 %149, label %150, label %151
150: ; preds = %140
store i32 1, i32* %9
br label %151
151: ; preds = %150, %140
%152 = load i8**, i8*** %23
%153 = load i32, i32* %24
%154 = sub i32 %153, 1
%155 = zext i32 %154 to i64
%156 = getelementptr inbounds i8*, i8** %152, i64 %155
%157 = load i8*, i8** %156
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8* %157)
br label %136
159: ; preds = %136
%160 = load i32*, i32** %22
%161 = call i32 @mysql_free_result(i32* %160)
br label %162
162: ; preds = %159, %88
%163 = load i32, i32* %9
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %162
%166 = load i8*, i8** %11
%167 = load i32, i32* %9
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i8* %166, i32 %167)
br label %169
169: ; preds = %165, %162
%170 = load i32*, i32** %2
%171 = load i8*, i8** %11
%172 = call i64 @mysql_select_db(i32* %170, i8* %171)
%173 = icmp eq i64 %172, 0
br i1 %173, label %174, label %266
174: ; preds = %169
%175 = load i8*, i8** %11
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.24, i64 0, i64 0), i8* %175)
%177 = load i32*, i32** %2
%178 = call i32* @mysql_list_tables(i32* %177, i32* null)
store i32* %178, i32** %27
%179 = load i32*, i32** %27
%180 = call i32 @mysql_num_fields(i32* %179)
store i32 %180, i32* %28
%181 = load i32*, i32** %27
%182 = call i64 @mysql_num_rows(i32* %181)
store i64 %182, i64* %29
%183 = load i32, i32* %28
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i32 %183)
%185 = load i64, i64* %29
%186 = trunc i64 %185 to i32
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), i32 %186)
%188 = load i32*, i32** %27
%189 = icmp ne i32* %188, null
br i1 %189, label %190, label %263
190: ; preds = %174
store i32 0, i32* %9
store i8** null, i8*** %30
br label %191
191: ; preds = %205, %190
%192 = load i32*, i32** %27
%193 = call i8** @mysql_fetch_row(i32* %192)
store i8** %193, i8*** %30
%194 = icmp ne i8** %193, null
br i1 %194, label %195, label %213
195: ; preds = %191
%196 = load i8**, i8*** %30
%197 = load i32, i32* %28
%198 = sub i32 %197, 1
%199 = zext i32 %198 to i64
%200 = getelementptr inbounds i8*, i8** %196, i64 %199
%201 = load i8*, i8** %200
%202 = call i64 @strcmp(i8* %201, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.26, i64 0, i64 0))
%203 = icmp eq i64 %202, 0
br i1 %203, label %204, label %205
204: ; preds = %195
store i32 1, i32* %9
br label %205
205: ; preds = %204, %195
%206 = load i8**, i8*** %30
%207 = load i32, i32* %28
%208 = sub i32 %207, 1
%209 = zext i32 %208 to i64
%210 = getelementptr inbounds i8*, i8** %206, i64 %209
%211 = load i8*, i8** %210
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0), i8* %211)
br label %191
213: ; preds = %191
%214 = load i32, i32* %9
%215 = icmp ne i32 %214, 0
br i1 %215, label %260, label %216
216: ; preds = %213
store i32* null, i32** %31
%217 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.29, i64 0, i64 0))
store i32* %217, i32** %31
%218 = load i32*, i32** %31
%219 = icmp ne i32* %218, null
br i1 %219, label %220, label %237
220: ; preds = %216
br label %221
221: ; preds = %226, %220
%222 = load i32*, i32** %31
%223 = call i32 @feof(i32* %222)
%224 = icmp ne i32 %223, 0
%225 = xor i1 %224, true
br i1 %225, label %226, label %234
226: ; preds = %221
%227 = bitcast [64 x i8]* %32 to i8*
%228 = getelementptr inbounds [64 x i8], [64 x i8]* %32, i64 0, i64 0
%229 = load i32*, i32** %31
%230 = call i32 @fgets(i8* %228, i32 64, i32* %229)
%231 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%232 = getelementptr inbounds [64 x i8], [64 x i8]* %32, i64 0, i64 0
%233 = call i32 @strcat(i8* %231, i8* %232)
br label %221
234: ; preds = %221
%235 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%236 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.30, i64 0, i64 0), i8* %235)
br label %242
237: ; preds = %216
%238 = load i32, i32* @stderr
%239 = call i32 (i32, i8*, ...) @fprintf(i32 %238, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.31, i64 0, i64 0))
%240 = load i32, i32* @EXIT_FAILURE
%241 = call i32 @exit(i32 %240)
unreachable
242: ; preds = %234
%243 = load i32*, i32** %31
%244 = call i32 @fclose(i32* %243)
%245 = load i32*, i32** %2
%246 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%247 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%248 = call i64 @strlen(i8* %247)
%249 = trunc i64 %248 to i32
%250 = call i32 @mysql_real_query(i32* %245, i8* %246, i32 %249)
store i32 %250, i32* %33
%251 = load i32, i32* %33
%252 = icmp eq i32 %251, 0
br i1 %252, label %253, label %255
253: ; preds = %242
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.32, i64 0, i64 0))
br label %259
255: ; preds = %242
%256 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.33, i64 0, i64 0))
%257 = load i32, i32* @EXIT_FAILURE
%258 = call i32 @exit(i32 %257)
unreachable
259: ; preds = %253
br label %262
260: ; preds = %213
%261 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.34, i64 0, i64 0))
br label %262
262: ; preds = %260, %259
br label %265
263: ; preds = %174
%264 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.35, i64 0, i64 0))
br label %265
265: ; preds = %263, %262
br label %266
266: ; preds = %265, %169
%267 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%268 = call i32 @memset(i8* %267, i32 0, i32 1024)
%269 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%270 = call i32 (i8*, i8*, ...) @sprintf(i8* %269, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.36, i64 0, i64 0))
store i32 0, i32* %34
%271 = load i32*, i32** %2
%272 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%273 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%274 = call i64 @strlen(i8* %273)
%275 = trunc i64 %274 to i32
%276 = call i32 @mysql_real_query(i32* %271, i8* %272, i32 %275)
%277 = icmp eq i32 %276, 0
br i1 %277, label %278, label %296
278: ; preds = %266
%279 = load i32*, i32** %2
%280 = call i32* @mysql_store_result(i32* %279)
store i32* %280, i32** %35
%281 = load i32*, i32** %35
%282 = call i32 @mysql_num_fields(i32* %281)
store i32 %282, i32* %36
%283 = load i32*, i32** %35
%284 = call i8** @mysql_fetch_row(i32* %283)
store i8** %284, i8*** %37
%285 = load i8**, i8*** %37
%286 = load i32, i32* %36
%287 = sub i32 %286, 1
%288 = zext i32 %287 to i64
%289 = getelementptr inbounds i8*, i8** %285, i64 %288
%290 = load i8*, i8** %289
%291 = call i32 @atoi(i8* %290)
store i32 %291, i32* %34
%292 = load i32, i32* %34
%293 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.37, i64 0, i64 0), i32 %292)
%294 = load i32*, i32** %35
%295 = call i32 @mysql_free_result(i32* %294)
br label %296
296: ; preds = %278, %266
%297 = load i32, i32* %34
%298 = icmp slt i32 %297, 50
br i1 %298, label %299, label %337
299: ; preds = %296
%300 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%301 = call i32 @memset(i8* %300, i32 0, i32 1024)
store i32 0, i32* %10
br label %302
302: ; preds = %333, %299
%303 = load i32, i32* %10
%304 = icmp slt i32 %303, 10
br i1 %304, label %305, label %336
305: ; preds = %302
%306 = bitcast [16 x i8]* %38 to i8*
%307 = bitcast [64 x i8]* %39 to i8*
%308 = getelementptr inbounds [16 x i8], [16 x i8]* %38, i64 0, i64 0
%309 = load i32, i32* %10
%310 = call i32 (i8*, i8*, ...) @sprintf(i8* %308, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.38, i64 0, i64 0), i32 %309)
%311 = getelementptr inbounds [64 x i8], [64 x i8]* %39, i64 0, i64 0
%312 = load i32, i32* %10
%313 = call i32 (i8*, i8*, ...) @sprintf(i8* %311, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.39, i64 0, i64 0), i32 %312)
%314 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%315 = getelementptr inbounds [16 x i8], [16 x i8]* %38, i64 0, i64 0
%316 = load i32, i32* %10
%317 = add nsw i32 10, %316
%318 = getelementptr inbounds [64 x i8], [64 x i8]* %39, i64 0, i64 0
%319 = call i32 (i8*, i8*, ...) @sprintf(i8* %314, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.40, i64 0, i64 0), i8* %315, i32 %317, i8* %318)
%320 = load i32*, i32** %2
%321 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%322 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%323 = call i64 @strlen(i8* %322)
%324 = trunc i64 %323 to i32
%325 = call i32 @mysql_real_query(i32* %320, i8* %321, i32 %324)
%326 = icmp eq i32 %325, 0
br i1 %326, label %327, label %332
327: ; preds = %305
%328 = load i32*, i32** %2
%329 = call i64 @mysql_insert_id(i32* %328)
store i64 %329, i64* %40
%330 = load i64, i64* %40
%331 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.41, i64 0, i64 0), i64 %330)
br label %332
332: ; preds = %327, %305
br label %333
333: ; preds = %332
%334 = load i32, i32* %10
%335 = add nsw i32 %334, 1
store i32 %335, i32* %10
br label %302
336: ; preds = %302
br label %337
337: ; preds = %336, %296
%338 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%339 = call i32 @memset(i8* %338, i32 0, i32 1024)
%340 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%341 = call i32 (i8*, i8*, ...) @sprintf(i8* %340, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.42, i64 0, i64 0))
%342 = load i32*, i32** %2
%343 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%344 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%345 = call i64 @strlen(i8* %344)
%346 = trunc i64 %345 to i32
%347 = call i32 @mysql_real_query(i32* %342, i8* %343, i32 %346)
%348 = icmp eq i32 %347, 0
br i1 %348, label %349, label %377
349: ; preds = %337
%350 = load i32*, i32** %2
%351 = call i32* @mysql_store_result(i32* %350)
store i32* %351, i32** %41
%352 = load i32*, i32** %41
%353 = call i32 @mysql_num_fields(i32* %352)
store i32 %353, i32* %42
%354 = load i32, i32* %42
%355 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.43, i64 0, i64 0), i32 %354)
br label %356
356: ; preds = %360, %349
%357 = load i32*, i32** %41
%358 = call i8** @mysql_fetch_row(i32* %357)
store i8** %358, i8*** %43
%359 = icmp ne i8** %358, null
br i1 %359, label %360, label %374
360: ; preds = %356
%361 = load i8**, i8*** %43
%362 = getelementptr inbounds i8*, i8** %361, i64 0
%363 = load i8*, i8** %362
%364 = load i8**, i8*** %43
%365 = getelementptr inbounds i8*, i8** %364, i64 1
%366 = load i8*, i8** %365
%367 = load i8**, i8*** %43
%368 = getelementptr inbounds i8*, i8** %367, i64 2
%369 = load i8*, i8** %368
%370 = load i8**, i8*** %43
%371 = getelementptr inbounds i8*, i8** %370, i64 3
%372 = load i8*, i8** %371
%373 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.44, i64 0, i64 0), i8* %363, i8* %366, i8* %369, i8* %372)
br label %356
374: ; preds = %356
%375 = load i32*, i32** %41
%376 = call i32 @mysql_free_result(i32* %375)
br label %377
377: ; preds = %374, %337
%378 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%379 = call i32 @memset(i8* %378, i32 0, i32 1024)
%380 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%381 = call i32 (i8*, i8*, ...) @sprintf(i8* %380, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.45, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.46, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.47, i64 0, i64 0), i32 1, i32 10)
%382 = load i32*, i32** %2
%383 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%384 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%385 = call i64 @strlen(i8* %384)
%386 = trunc i64 %385 to i32
%387 = call i32 @mysql_real_query(i32* %382, i8* %383, i32 %386)
%388 = icmp eq i32 %387, 0
br i1 %388, label %389, label %394
389: ; preds = %377
%390 = load i32*, i32** %2
%391 = call i64 @mysql_affected_rows(i32* %390)
%392 = trunc i64 %391 to i32
%393 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.48, i64 0, i64 0), i32 %392)
br label %394
394: ; preds = %389, %377
%395 = load i32*, i32** %2
%396 = call i32 @mysql_close(i32* %395)
%397 = call i32 (...) @mysql_library_end()
%398 = load i32, i32* @EXIT_SUCCESS
store i32 %398, i32* %1
br label %399
399: ; preds = %394, %86, %72, %57
%400 = load i32, i32* %1
ret i32 %400
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"root\00"
@.str.2 = [12 x i8] c"fgap_config\00"
@.str.3 = [28 x i8] c"/var/run/mysqld/mysqld.sock\00"
@.str.4 = [5 x i8] c"test\00"
@stderr = global i32 0
@.str.5 = [43 x i8] c"could not initialize MySQL client library\0A\00"
@EXIT_FAILURE = global i32 0
@.str.6 = [17 x i8] c"mysql_init error\00"
@.str.8 = [42 x i8] c"Failed to connect to database: Error: %s\0A\00"
@.str.11 = [28 x i8] c"mysql_get_client_info : %s\0A\00"
@.str.12 = [32 x i8] c"mysql_get_client_version : %ld\0A\00"
@.str.13 = [28 x i8] c"mysql_get_server_info : %s\0A\00"
@.str.14 = [26 x i8] c"mysql_get_host_info : %s\0A\00"
@.str.15 = [27 x i8] c"mysql_get_proto_info : %d\0A\00"
@.str.16 = [32 x i8] c"mysql_get_server_version : %ld\0A\00"
@.str.17 = [17 x i8] c"mysql_info : %s\0A\00"
@.str.18 = [17 x i8] c"mysql_stat : %s\0A\00"
@.str.19 = [23 x i8] c"mysql_num_fields : %d\0A\00"
@.str.20 = [22 x i8] c"mysql_num_rows : %ld\0A\00"
@.str.21 = [24 x i8] c"mysql_field_count : %d\0A\00"
@.str.22 = [17 x i8] c"database: %-10s\0A\00"
@.str.23 = [16 x i8] c"no %s db -> %d\0A\00"
@.str.24 = [37 x i8] c"mysql_select_db(mysql, %s) success \0A\00"
@.str.25 = [21 x i8] c"mysql_num_rows : %d\0A\00"
@.str.26 = [8 x i8] c"student\00"
@.str.27 = [15 x i8] c"table : %-10s\0A\00"
@.str.28 = [12 x i8] c"student.sql\00"
@.str.29 = [2 x i8] c"r\00"
@.str.31 = [25 x i8] c"fopen student.sql error\0A\00"
@.str.36 = [30 x i8] c"select count(id) from student\00"
@.str.37 = [10 x i8] c"count %d\0A\00"
@.str.38 = [8 x i8] c"zing-%d\00"
@.str.39 = [16 x i8] c"jiangsu-wuxi-%d\00"
@.str.40 = [70 x i8] c"INSERT INTO `student` (`name`,`age`,`address`) VALUES('%s','%d','%s')\00"
@.str.41 = [24 x i8] c"insert num %ld success\0A\00"
@.str.42 = [49 x i8] c"select * from student order by id asc limit 0,20\00"
@.str.43 = [11 x i8] c"fields %d\0A\00"
@.str.44 = [34 x i8] c"id:%s name:%s age:%s address:%s \0A\00"
@.str.45 = [77 x i8] c"update student set name='%s',age=%d,address='%s' where id between %d and %d;\00"
@.str.46 = [15 x i8] c"zhangrongxiang\00"
@.str.47 = [17 x i8] c"jiangsu-xuzhou-1\00"
@.str.48 = [26 x i8] c"mysql_affected_rows : %d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [19 x i8] c"mysql_init success\00"
@str.49 = [27 x i8] c"mysql_real_connect success\00"
@str.50 = [18 x i8] c"mysql is active !\00"
@str.51 = [16 x i8] c"something wrong\00"
@str.52 = [36 x i8] c"table student was created error !! \00"
@str.53 = [38 x i8] c"table student was created success !! \00"
@str.54 = [33 x i8] c"table student already exists !! \00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [64 x i8]
%3 = alloca [16 x i8]
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%6 = tail call i64 @mysql_library_init(i32 0, i32* null, i32* null)
%7 = icmp eq i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %0
%14 = tail call i32* @mysql_init(i32* null)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %226
18: ; preds = %13
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%20 = tail call i32* @mysql_real_connect(i32* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 3306, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 0)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = tail call i8* @mysql_error(i32* null)
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i8* %24)
br label %226
26: ; preds = %18
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.49, i64 0, i64 0))
%28 = tail call i32 @mysql_ping(i32* %20)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %226
30: ; preds = %26
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.50, i64 0, i64 0))
%32 = tail call i8* (...) @mysql_get_client_info()
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i8* %32)
%34 = tail call i64 (...) @mysql_get_client_version()
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i64 %34)
%36 = tail call i8* @mysql_get_server_info(i32* %20)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %36)
%38 = tail call i8* @mysql_get_host_info(i32* %20)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %38)
%40 = tail call i32 @mysql_get_proto_info(i32* %20)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i32 %40)
%42 = tail call i64 @mysql_get_server_version(i32* %20)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0), i64 %42)
%44 = tail call i8* @mysql_info(i32* %20)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i8* %44)
%46 = tail call i8* @mysql_stat(i32* %20)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i8* %46)
%48 = tail call i32* @mysql_list_dbs(i32* %20, i32* null)
%49 = icmp eq i32* %48, null
br i1 %49, label %79, label %50
50: ; preds = %30
%51 = tail call i32 @mysql_num_fields(i32* %48)
%52 = tail call i64 @mysql_num_rows(i32* %48)
%53 = tail call i32 @mysql_field_count(i32* %20)
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i32 %51)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i64 %52)
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.21, i64 0, i64 0), i32 %53)
%57 = tail call i8** @mysql_fetch_row(i32* %48)
%58 = icmp eq i8** %57, null
br i1 %58, label %59, label %61
59: ; preds = %50
%60 = tail call i32 @mysql_free_result(i32* %48)
br label %79
61: ; preds = %50
%62 = add i32 %51, -1
%63 = zext i32 %62 to i64
br label %64
64: ; preds = %61, %64
%65 = phi i8** [ %57, %61 ], [ %74, %64 ]
%66 = phi i32 [ 0, %61 ], [ %71, %64 ]
%67 = getelementptr inbounds i8*, i8** %65, i64 %63
%68 = load i8*, i8** %67
%69 = tail call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
%71 = select i1 %70, i32 1, i32 %66
%72 = load i8*, i8** %67
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8* %72)
%74 = tail call i8** @mysql_fetch_row(i32* %48)
%75 = icmp eq i8** %74, null
br i1 %75, label %76, label %64
76: ; preds = %64
%77 = tail call i32 @mysql_free_result(i32* %48)
%78 = icmp eq i32 %71, 0
br i1 %78, label %79, label %81
79: ; preds = %59, %30, %76
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0)
br label %81
81: ; preds = %79, %76
%82 = tail call i64 @mysql_select_db(i32* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %148
84: ; preds = %81
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%86 = tail call i32* @mysql_list_tables(i32* %20, i32* null)
%87 = tail call i32 @mysql_num_fields(i32* %86)
%88 = tail call i64 @mysql_num_rows(i32* %86)
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i32 %87)
%90 = trunc i64 %88 to i32
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), i32 %90)
%92 = icmp eq i32* %86, null
br i1 %92, label %146, label %93
93: ; preds = %84
%94 = tail call i8** @mysql_fetch_row(i32* %86)
%95 = icmp eq i8** %94, null
br i1 %95, label %113, label %96
96: ; preds = %93
%97 = add i32 %87, -1
%98 = zext i32 %97 to i64
br label %99
99: ; preds = %96, %99
%100 = phi i8** [ %94, %96 ], [ %109, %99 ]
%101 = phi i32 [ 0, %96 ], [ %106, %99 ]
%102 = getelementptr inbounds i8*, i8** %100, i64 %98
%103 = load i8*, i8** %102
%104 = tail call i64 @strcmp(i8* %103, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.26, i64 0, i64 0))
%105 = icmp eq i64 %104, 0
%106 = select i1 %105, i32 1, i32 %101
%107 = load i8*, i8** %102
%108 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0), i8* %107)
%109 = tail call i8** @mysql_fetch_row(i32* %86)
%110 = icmp eq i8** %109, null
br i1 %110, label %111, label %99
111: ; preds = %99
%112 = icmp eq i32 %106, 0
br i1 %112, label %113, label %144
113: ; preds = %93, %111
%114 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.29, i64 0, i64 0))
%115 = icmp eq i32* %114, null
br i1 %115, label %133, label %116
116: ; preds = %113
%117 = call i32 @feof(i32* %114)
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %126
119: ; preds = %116
%120 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
br label %121
121: ; preds = %119, %121
%122 = call i32 @fgets(i8* %120, i32 64, i32* %114)
%123 = call i32 @strcat(i8* %5, i8* %120)
%124 = call i32 @feof(i32* %114)
%125 = icmp eq i32 %124, 0
br i1 %125, label %121, label %126
126: ; preds = %121, %116
%127 = call i32 @puts(i8* %5)
%128 = call i32 @fclose(i32* %114)
%129 = call i64 @strlen(i8* %5)
%130 = trunc i64 %129 to i32
%131 = call i32 @mysql_real_query(i32* %20, i8* %5, i32 %130)
%132 = icmp eq i32 %131, 0
br i1 %132, label %138, label %140
133: ; preds = %113
%134 = load i32, i32* @stderr
%135 = tail call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.31, i64 0, i64 0))
%136 = load i32, i32* @EXIT_FAILURE
%137 = tail call i32 @exit(i32 %136)
unreachable
138: ; preds = %126
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.53, i64 0, i64 0))
br label %148
140: ; preds = %126
%141 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.52, i64 0, i64 0))
%142 = load i32, i32* @EXIT_FAILURE
%143 = call i32 @exit(i32 %142)
unreachable
144: ; preds = %111
%145 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.54, i64 0, i64 0))
br label %148
146: ; preds = %84
%147 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.51, i64 0, i64 0))
br label %148
148: ; preds = %146, %144, %138, %81
%149 = call i32 @memset(i8* %5, i32 0, i32 1024)
%150 = call i64 @strlen(i8* %5)
%151 = trunc i64 %150 to i32
%152 = call i32 @mysql_real_query(i32* %20, i8* %5, i32 %151)
%153 = icmp eq i32 %152, 0
br i1 %153, label %154, label %166
154: ; preds = %148
%155 = call i32* @mysql_store_result(i32* %20)
%156 = call i32 @mysql_num_fields(i32* %155)
%157 = call i8** @mysql_fetch_row(i32* %155)
%158 = add i32 %156, -1
%159 = zext i32 %158 to i64
%160 = getelementptr inbounds i8*, i8** %157, i64 %159
%161 = load i8*, i8** %160
%162 = call i32 @atoi(i8* %161)
%163 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.37, i64 0, i64 0), i32 %162)
%164 = call i32 @mysql_free_result(i32* %155)
%165 = icmp slt i32 %162, 50
br i1 %165, label %166, label %186
166: ; preds = %148, %154
%167 = call i32 @memset(i8* %5, i32 0, i32 1024)
%168 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%169 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
br label %170
170: ; preds = %166, %183
%171 = phi i32 [ 0, %166 ], [ %184, %183 ]
%172 = call i32 (i8*, i8*, ...) @sprintf(i8* %168, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.38, i64 0, i64 0), i32 %171)
%173 = call i32 (i8*, i8*, ...) @sprintf(i8* %169, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.39, i64 0, i64 0), i32 %171)
%174 = add nuw nsw i32 %171, 10
%175 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.40, i64 0, i64 0), i8* %168, i32 %174, i8* %169)
%176 = call i64 @strlen(i8* %5)
%177 = trunc i64 %176 to i32
%178 = call i32 @mysql_real_query(i32* %20, i8* %5, i32 %177)
%179 = icmp eq i32 %178, 0
br i1 %179, label %180, label %183
180: ; preds = %170
%181 = call i64 @mysql_insert_id(i32* %20)
%182 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.41, i64 0, i64 0), i64 %181)
br label %183
183: ; preds = %180, %170
%184 = add nuw nsw i32 %171, 1
%185 = icmp eq i32 %184, 10
br i1 %185, label %186, label %170
186: ; preds = %183, %154
%187 = call i32 @memset(i8* %5, i32 0, i32 1024)
%188 = call i64 @strlen(i8* %5)
%189 = trunc i64 %188 to i32
%190 = call i32 @mysql_real_query(i32* %20, i8* %5, i32 %189)
%191 = icmp eq i32 %190, 0
br i1 %191, label %192, label %212
192: ; preds = %186
%193 = call i32* @mysql_store_result(i32* %20)
%194 = call i32 @mysql_num_fields(i32* %193)
%195 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.43, i64 0, i64 0), i32 %194)
%196 = call i8** @mysql_fetch_row(i32* %193)
%197 = icmp eq i8** %196, null
br i1 %197, label %210, label %198
198: ; preds = %192, %198
%199 = phi i8** [ %208, %198 ], [ %196, %192 ]
%200 = load i8*, i8** %199
%201 = getelementptr inbounds i8*, i8** %199, i64 1
%202 = load i8*, i8** %201
%203 = getelementptr inbounds i8*, i8** %199, i64 2
%204 = load i8*, i8** %203
%205 = getelementptr inbounds i8*, i8** %199, i64 3
%206 = load i8*, i8** %205
%207 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.44, i64 0, i64 0), i8* %200, i8* %202, i8* %204, i8* %206)
%208 = call i8** @mysql_fetch_row(i32* %193)
%209 = icmp eq i8** %208, null
br i1 %209, label %210, label %198
210: ; preds = %198, %192
%211 = call i32 @mysql_free_result(i32* %193)
br label %212
212: ; preds = %210, %186
%213 = call i32 @memset(i8* %5, i32 0, i32 1024)
%214 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.45, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.46, i64 0, i64 0), i32 24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.47, i64 0, i64 0), i32 1, i32 10)
%215 = call i64 @strlen(i8* %5)
%216 = trunc i64 %215 to i32
%217 = call i32 @mysql_real_query(i32* %20, i8* %5, i32 %216)
%218 = icmp eq i32 %217, 0
br i1 %218, label %219, label %223
219: ; preds = %212
%220 = call i64 @mysql_affected_rows(i32* %20)
%221 = trunc i64 %220 to i32
%222 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.48, i64 0, i64 0), i32 %221)
br label %223
223: ; preds = %219, %212
%224 = call i32 @mysql_close(i32* %20)
%225 = call i32 (...) @mysql_library_end()
br label %226
226: ; preds = %223, %26, %22, %16
%227 = phi i32* [ @EXIT_FAILURE, %16 ], [ @EXIT_FAILURE, %22 ], [ @EXIT_SUCCESS, %223 ], [ @EXIT_FAILURE, %26 ]
%228 = load i32, i32* %227
ret i32 %228
}