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

/* Variables and functions */
int /*<<< orphan*/ CheckTestTable(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ ConnectMySQL(int /*<<< orphan*/ *, char *, char *, char *,
                                char *);
int /*<<< orphan*/ CreateTestTable(int /*<<< orphan*/ *, int);
int EXIT_SUCCESS;
int /*<<< orphan*/ RemoveTestTable(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ mysql_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ usleep(int);
int main(void) {
  char *cServerIps[5] = {"127.0.0.1", "192.168.22.130", "", ""};
  char *cDbLogin = "unxsvz";
  char *cDbPwd = "wsxedc";
  char *cDbName = "unxsvz";
  MYSQL MySQLVectors[5];
  int i = 0;
  int j;
  int x;
  while (1) {
    ConnectMySQL(&MySQLVectors[i], cServerIps[i], cDbLogin, cDbPwd, cDbName);
    i++;
    if (!cServerIps[i][0])
      break;
  }
  printf("Connected to %i MySQL servers OK\n", i);
  for (j = 0; j < i; j++)
    CreateTestTable(&MySQLVectors[j], j);
  usleep(20);
  for (j = 0; j < i; j++) {
    for (x = 0; x < i; x++) {
      CheckTestTable(&MySQLVectors[j], j, x);
    }
  }
  for (j = 0; j < i; j++)
    RemoveTestTable(&MySQLVectors[j], j);
  for (j = 0; j < i; j++)
    mysql_close(&MySQLVectors[j]);
  printf("Disconnected from %i MySQL servers OK\n", j);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
lea    0xe5a(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe59(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe47(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe43(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe31(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rax
lea    -0x60(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x64(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
call   1030 <ConnectMySQL@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
cmpb   $0x0,(%rax)
jne    123c <main+0xbc>
jmp    1241 <main+0xc1>
jmp    11f3 <main+0x73>
mov    -0x64(%rbp),%esi
lea    0xddc(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1288 <main+0x108>
movslq -0x68(%rbp),%rax
lea    -0x60(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x68(%rbp),%esi
call   1040 <CreateTestTable@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1257 <main+0xd7>
mov    $0x14,%edi
call   10a0 <usleep@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    12f3 <main+0x173>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    12e0 <main+0x160>
movslq -0x68(%rbp),%rax
lea    -0x60(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x68(%rbp),%esi
mov    -0x6c(%rbp),%edx
call   1080 <CheckTestTable@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    12ac <main+0x12c>
jmp    12e5 <main+0x165>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1299 <main+0x119>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    132b <main+0x1ab>
movslq -0x68(%rbp),%rax
lea    -0x60(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x68(%rbp),%esi
call   1060 <RemoveTestTable@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    12fa <main+0x17a>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1360 <main+0x1e0>
movslq -0x68(%rbp),%rax
lea    -0x60(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1090 <mysql_close@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1332 <main+0x1b2>
mov    -0x68(%rbp),%esi
lea    0xcdf(%rip),%rdi
call   1050 <printf@plt>
mov    0x2c6a(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
movq   $0x0,0x40(%rsp)
lea    0xe74(%rip),%rsi
mov    %rsi,0x20(%rsp)
lea    0xe72(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xecb(%rip),%rax
mov    %rax,0x30(%rsp)
mov    %rax,0x38(%rsp)
mov    %rsp,%r14
xor    %r15d,%r15d
lea    0xe65(%rip),%r12
lea    0xe57(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
call   1030 <ConnectMySQL@plt>
mov    0x28(%rsp,%r15,8),%rsi
add    $0x1,%r15
add    $0x4,%r14
cmpb   $0x0,(%rsi)
jne    11d0 <main+0x60>
lea    0xe2d(%rip),%rdi
mov    %r15d,%esi
call   1050 <printf@plt>
mov    %r15d,%r12d
mov    %rsp,%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <CreateTestTable@plt>
add    $0x1,%rbx
add    $0x4,%r14
cmp    %rbx,%r12
jne    1210 <main+0xa0>
mov    $0x14,%edi
call   1090 <usleep@plt>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rsp,%r14,4),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1070 <CheckTestTable@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1250 <main+0xe0>
add    $0x1,%r14
cmp    %r12,%r14
jne    1240 <main+0xd0>
mov    %r15d,%ebp
mov    %rsp,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <RemoveTestTable@plt>
add    $0x1,%rbx
add    $0x4,%r14
cmp    %rbx,%rbp
jne    1280 <main+0x110>
mov    %r15d,%ebp
mov    %rsp,%rbx
nopl   (%rax)
mov    %rbx,%rdi
call   1080 <mysql_close@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%rbp
jne    12a0 <main+0x130>
lea    0xd90(%rip),%rdi
mov    %r15d,%esi
call   1050 <printf@plt>
mov    0x2d18(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [15 x i8] c"192.168.22.130\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [7 x i8] c"unxsvz\00"
@.str.4 = [7 x i8] c"wsxedc\00"
@.str.5 = [34 x i8] c"Connected to %i MySQL servers OK\0A\00"
@.str.6 = [39 x i8] c"Disconnected from %i MySQL servers OK\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8*]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [5 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [5 x i8*]* %2 to i8*
%11 = bitcast i8* %10 to [5 x i8*]*
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %11, i32 0, i32 3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i32 0, i32 0), i8** %15
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %5
store i32 0, i32* %7
br label %16
16: ; preds = %0, %38
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %18
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = load i8*, i8** %3
%25 = load i8*, i8** %4
%26 = load i8*, i8** %5
%27 = call i32 @ConnectMySQL(i32* %19, i8* %23, i8* %24, i8* %25, i8* %26)
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %31
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %16
br label %39
38: ; preds = %16
br label %16
39: ; preds = %37
%40 = load i32, i32* %7
%41 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32 %40)
store i32 0, i32* %8
br label %42
42: ; preds = %52, %39
%43 = load i32, i32* %8
%44 = load i32, i32* %7
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = load i32, i32* %8
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %48
%50 = load i32, i32* %8
%51 = call i32 @CreateTestTable(i32* %49, i32 %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %42
55: ; preds = %42
%56 = call i32 @usleep(i32 20)
store i32 0, i32* %8
br label %57
57: ; preds = %77, %55
%58 = load i32, i32* %8
%59 = load i32, i32* %7
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %80
61: ; preds = %57
store i32 0, i32* %9
br label %62
62: ; preds = %73, %61
%63 = load i32, i32* %9
%64 = load i32, i32* %7
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %68
%70 = load i32, i32* %8
%71 = load i32, i32* %9
%72 = call i32 @CheckTestTable(i32* %69, i32 %70, i32 %71)
br label %73
73: ; preds = %66
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 1
store i32 %75, i32* %9
br label %62
76: ; preds = %62
br label %77
77: ; preds = %76
%78 = load i32, i32* %8
%79 = add nsw i32 %78, 1
store i32 %79, i32* %8
br label %57
80: ; preds = %57
store i32 0, i32* %8
br label %81
81: ; preds = %91, %80
%82 = load i32, i32* %8
%83 = load i32, i32* %7
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %94
85: ; preds = %81
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %87
%89 = load i32, i32* %8
%90 = call i32 @RemoveTestTable(i32* %88, i32 %89)
br label %91
91: ; preds = %85
%92 = load i32, i32* %8
%93 = add nsw i32 %92, 1
store i32 %93, i32* %8
br label %81
94: ; preds = %81
store i32 0, i32* %8
br label %95
95: ; preds = %104, %94
%96 = load i32, i32* %8
%97 = load i32, i32* %7
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %107
99: ; preds = %95
%100 = load i32, i32* %8
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %101
%103 = call i32 @mysql_close(i32* %102)
br label %104
104: ; preds = %99
%105 = load i32, i32* %8
%106 = add nsw i32 %105, 1
store i32 %106, i32* %8
br label %95
107: ; preds = %95
%108 = load i32, i32* %8
%109 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %108)
%110 = load i32, i32* @EXIT_SUCCESS
ret i32 %110
}

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [15 x i8] c"192.168.22.130\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [7 x i8] c"unxsvz\00"
@.str.4 = [7 x i8] c"wsxedc\00"
@.str.5 = [34 x i8] c"Connected to %i MySQL servers OK\0A\00"
@.str.6 = [39 x i8] c"Disconnected from %i MySQL servers OK\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [5 x i8*]
%2 = alloca [5 x i32]
%3 = bitcast [5 x i8*]* %1 to i8*
%4 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 4
%5 = bitcast i8** %4 to i64*
store i64 0, i64* %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %9
%10 = bitcast [5 x i32]* %2 to i8*
br label %11
11: ; preds = %11, %0
%12 = phi i8* [ %18, %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %0 ]
%13 = phi i64 [ %16, %11 ], [ 0, %0 ]
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %13
%15 = call i32 @ConnectMySQL(i32* %14, i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = add nuw i64 %13, 1
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %11
21: ; preds = %11
%22 = trunc i64 %13 to i32
%23 = trunc i64 %16 to i32
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%25 = add i32 %22, 1
%26 = zext i32 %25 to i64
br label %27
27: ; preds = %21, %27
%28 = phi i64 [ 0, %21 ], [ %32, %27 ]
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %28
%30 = trunc i64 %28 to i32
%31 = call i32 @CreateTestTable(i32* %29, i32 %30)
%32 = add nuw nsw i64 %28, 1
%33 = icmp eq i64 %32, %26
br i1 %33, label %34, label %27
34: ; preds = %27
%35 = call i32 @usleep(i32 20)
br label %36
36: ; preds = %34, %45
%37 = phi i64 [ 0, %34 ], [ %46, %45 ]
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %37
%39 = trunc i64 %37 to i32
br label %40
40: ; preds = %36, %40
%41 = phi i32 [ 0, %36 ], [ %43, %40 ]
%42 = call i32 @CheckTestTable(i32* %38, i32 %39, i32 %41)
%43 = add nuw i32 %41, 1
%44 = icmp eq i32 %41, %22
br i1 %44, label %45, label %40
45: ; preds = %40
%46 = add nuw nsw i64 %37, 1
%47 = icmp eq i64 %46, %26
br i1 %47, label %48, label %36
48: ; preds = %45, %48
%49 = phi i64 [ %53, %48 ], [ 0, %45 ]
%50 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %49
%51 = trunc i64 %49 to i32
%52 = call i32 @RemoveTestTable(i32* %50, i32 %51)
%53 = add nuw nsw i64 %49, 1
%54 = icmp eq i64 %53, %26
br i1 %54, label %55, label %48
55: ; preds = %48, %55
%56 = phi i64 [ %59, %55 ], [ 0, %48 ]
%57 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %56
%58 = call i32 @mysql_close(i32* %57)
%59 = add nuw nsw i64 %56, 1
%60 = icmp eq i64 %59, %26
br i1 %60, label %61, label %55
61: ; preds = %55
%62 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%63 = load i32, i32* @EXIT_SUCCESS
ret i32 %63
}