#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 char **MYSQL_ROW;
typedef int /*<<< orphan*/ MYSQL_RES;
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
char *mysql_error(int /*<<< orphan*/ *);
char **mysql_fetch_row(int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_init(int /*<<< orphan*/ *);
int mysql_query(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ mysql_real_connect(int /*<<< orphan*/ *, char *, char *,
                                      char *, char *, int /*<<< orphan*/,
                                      int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *mysql_use_result(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char month;
  char queryCopy[400] = "INSERT INTO";
  char queryInit[400] = "INSERT INTO";
  char attendSHEET[25] = "attendanceSheet";
  MYSQL *connectionWD, *connectionAS;
  MYSQL_RES *resWD, *resAS;
  MYSQL_ROW rowWD, rowAS;
  int retCode = 0;
  printf("Connecting to Database....");
  connectionWD = mysql_init(NULL);
  connectionAS = mysql_init(NULL);
  char *server = "localhost";
  char *user = "root";
  char *password = "omni";
  char *database = "omniPresence";
  if (!mysql_real_connect(connectionWD, server, user, password, database, 0,
                          NULL, 0)) {
    printf("UNABLE TO CONTACT WORKERS DATABASE...%s\n",
           mysql_error(connectionWD));
    return 1;
  }
  if (!mysql_real_connect(connectionAS, server, user, password, database, 0,
                          NULL, 0)) {
    printf("UNABLE TO CONNECT ATTENDANCE SHEET...%s\n",
           mysql_error(connectionAS));
    return 1;
  }
  printf("done\n");
  printf("Please Enter the month for which the rNad is to be created:");
  scanf("%s", &month);
  strcat(attendSHEET, &month);
  strcat(attendSHEET, "09");
  printf("AttendanceSheet Selected is %s\n", attendSHEET);
  char queryWD[] = "SELECT rNad FROM workersDB";
  retCode = mysql_query(connectionWD, queryWD);
  if (retCode != 0) {
    printf("ERROR IN PARSING QUERY TO DATABASE...%s\n",
           mysql_error(connectionWD));
    return 1;
  }
  resWD = mysql_use_result(connectionWD);
  if (resWD == NULL)
    printf("NO RESULT RETURNED BY QUERY.\n");
  while ((rowWD = mysql_fetch_row(resWD)) != NULL) {
    strcat(queryCopy, attendSHEET);
    strcat(queryCopy, " (rNAD) values('");
    strcat(queryCopy, rowWD[0]);
    strcat(queryCopy, "')");
    printf("Query:  %s\n", queryCopy);
    strcpy(queryCopy, queryInit);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    0xe30(%rip),%rsi
mov    $0x190,%edx
call   1070 <memcpy@plt>
lea    -0x330(%rbp),%rdi
lea    0xfa8(%rip),%rsi
mov    $0x190,%edx
call   1070 <memcpy@plt>
mov    0x1127(%rip),%rax
mov    %rax,-0x350(%rbp)
mov    0x1121(%rip),%rax
mov    %rax,-0x348(%rbp)
mov    0x111b(%rip),%rax
mov    %rax,-0x340(%rbp)
mov    0x1116(%rip),%al
mov    %al,-0x338(%rbp)
movl   $0x0,-0x384(%rbp)
lea    0x1100(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <mysql_init@plt>
mov    %rax,-0x358(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <mysql_init@plt>
mov    %rax,-0x360(%rbp)
lea    0x10ed(%rip),%rax
mov    %rax,-0x390(%rbp)
lea    0x10e9(%rip),%rax
mov    %rax,-0x398(%rbp)
lea    0x10e0(%rip),%rax
mov    %rax,-0x3a0(%rbp)
lea    0x10d7(%rip),%rax
mov    %rax,-0x3a8(%rbp)
mov    -0x358(%rbp),%rdi
mov    -0x390(%rbp),%rsi
mov    -0x398(%rbp),%rdx
mov    -0x3a0(%rbp),%rcx
mov    -0x3a8(%rbp),%r8
xor    %r9d,%r9d
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1080 <mysql_real_connect@plt>
cmp    $0x0,%eax
jne    1307 <main+0x157>
mov    -0x358(%rbp),%rdi
call   10c0 <mysql_error@plt>
mov    %rax,%rsi
lea    0x1081(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1541 <main+0x391>
mov    -0x360(%rbp),%rdi
mov    -0x390(%rbp),%rsi
mov    -0x398(%rbp),%rdx
mov    -0x3a0(%rbp),%rcx
mov    -0x3a8(%rbp),%r8
xor    %r9d,%r9d
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1080 <mysql_real_connect@plt>
cmp    $0x0,%eax
jne    1376 <main+0x1c6>
mov    -0x360(%rbp),%rdi
call   10c0 <mysql_error@plt>
mov    %rax,%rsi
lea    0x103b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1541 <main+0x391>
lea    0x104a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0x1042(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0x1070(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1090 <scanf@plt>
lea    -0x350(%rbp),%rdi
lea    -0x5(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x350(%rbp),%rdi
lea    0x104c(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x350(%rbp),%rsi
lea    0x103c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x10bf(%rip),%rax
mov    %rax,-0x3d0(%rbp)
mov    0x10b9(%rip),%rax
mov    %rax,-0x3c8(%rbp)
mov    0x10b3(%rip),%rax
mov    %rax,-0x3c0(%rbp)
mov    0x10ad(%rip),%ax
mov    %ax,-0x3b8(%rbp)
mov    0x10a2(%rip),%al
mov    %al,-0x3b6(%rbp)
mov    -0x358(%rbp),%rdi
lea    -0x3d0(%rbp),%rsi
call   1040 <mysql_query@plt>
mov    %eax,-0x384(%rbp)
cmpl   $0x0,-0x384(%rbp)
je     146d <main+0x2bd>
mov    -0x358(%rbp),%rdi
call   10c0 <mysql_error@plt>
mov    %rax,%rsi
lea    0xfd5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1541 <main+0x391>
mov    -0x358(%rbp),%rdi
call   10b0 <mysql_use_result@plt>
mov    %rax,-0x368(%rbp)
cmpq   $0x0,-0x368(%rbp)
jne    149c <main+0x2ec>
lea    0xfc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14a1 <main+0x2f1>
mov    -0x368(%rbp),%rdi
call   1050 <mysql_fetch_row@plt>
mov    %rax,-0x378(%rbp)
cmp    $0x0,%rax
je     153a <main+0x38a>
lea    -0x1a0(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x1a0(%rbp),%rdi
lea    0xf97(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x378(%rbp),%rax
mov    (%rax),%rsi
call   10d0 <strcat@plt>
lea    -0x1a0(%rbp),%rdi
lea    0xf7f(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1a0(%rbp),%rsi
lea    0xf6f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x330(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    14a1 <main+0x2f1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x378,%rsp
lea    0xe28(%rip),%rbx
lea    0x1e0(%rsp),%rdi
mov    $0x190,%edx
mov    %rbx,%rsi
call   1080 <memcpy@plt>
lea    0x50(%rsp),%rdi
mov    $0x190,%edx
mov    %rbx,%rsi
call   1080 <memcpy@plt>
movups 0xf93(%rip),%xmm0
movups %xmm0,0x19(%rsp)
movaps 0xf7e(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xf8b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   10b0 <mysql_init@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   10b0 <mysql_init@plt>
mov    %rax,%rbp
lea    0xf84(%rip),%rsi
lea    0xf87(%rip),%rdx
lea    0xf85(%rip),%rcx
lea    0xf83(%rip),%r8
mov    %rbx,%rdi
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1090 <mysql_real_connect@plt>
add    $0x10,%rsp
test   %eax,%eax
je     133f <main+0x17f>
lea    0xf4d(%rip),%rsi
lea    0xf50(%rip),%rdx
lea    0xf4e(%rip),%rcx
lea    0xf4c(%rip),%r8
mov    %rbp,%rdi
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1090 <mysql_real_connect@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1350 <main+0x190>
lea    0x1034(%rip),%rdi
call   1040 <puts@plt>
lea    0xf7d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xfab(%rip),%rdi
lea    0xf(%rsp),%r14
mov    %r14,%rsi
call   10a0 <scanf@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
lea    0xf8a(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <strcat@plt>
lea    0xf7e(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
movups 0x100f(%rip),%xmm0
movups %xmm0,0x3b(%rsp)
movaps 0xff8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <mysql_query@plt>
mov    %rbx,%rdi
test   %eax,%eax
je     1384 <main+0x1c4>
call   10d0 <mysql_error@plt>
lea    0xf5c(%rip),%rdi
jmp    135f <main+0x19f>
mov    %rbx,%rdi
call   10d0 <mysql_error@plt>
lea    0xe97(%rip),%rdi
jmp    135f <main+0x19f>
mov    %rbp,%rdi
call   10d0 <mysql_error@plt>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x378,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
call   10c0 <mysql_use_result@plt>
mov    %rax,%r14
test   %rax,%rax
jne    139d <main+0x1dd>
lea    0xf4f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <mysql_fetch_row@plt>
test   %rax,%rax
je     1434 <main+0x274>
mov    %rax,%r13
lea    0x1e0(%rsp),%rbx
lea    0xf16(%rip),%rbp
lea    0x50(%rsp),%r15
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
lea    0xedb(%rip),%rsi
call   10e0 <strcat@plt>
mov    0x0(%r13),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
lea    0xed1(%rip),%rsi
call   10e0 <strcat@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1060 <mysql_fetch_row@plt>
mov    %rax,%r13
test   %rax,%rax
jne    13d0 <main+0x210>
jmp    136f <main+0x1af>
xor    %r12d,%r12d
jmp    136f <main+0x1af>

LLVM IR (-O0):
@__const.main.queryCopy = [400 x i8] c"INSERT INTO\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.queryInit = [400 x i8] c"INSERT INTO\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.attendSHEET = [25 x i8] c"attendanceSheet\00\00\00\00\00\00\00\00\00\00"
@.str = [27 x i8] c"Connecting to Database....\00"
@.str.1 = [10 x i8] c"localhost\00"
@.str.2 = [5 x i8] c"root\00"
@.str.3 = [5 x i8] c"omni\00"
@.str.4 = [13 x i8] c"omniPresence\00"
@.str.5 = [41 x i8] c"UNABLE TO CONTACT WORKERS DATABASE...%s\0A\00"
@.str.6 = [41 x i8] c"UNABLE TO CONNECT ATTENDANCE SHEET...%s\0A\00"
@.str.7 = [6 x i8] c"done\0A\00"
@.str.8 = [60 x i8] c"Please Enter the month for which the rNad is to be created:\00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [3 x i8] c"09\00"
@.str.11 = [32 x i8] c"AttendanceSheet Selected is %s\0A\00"
@__const.main.queryWD = [27 x i8] c"SELECT rNad FROM workersDB\00"
@.str.12 = [41 x i8] c"ERROR IN PARSING QUERY TO DATABASE...%s\0A\00"
@.str.13 = [30 x i8] c"NO RESULT RETURNED BY QUERY.\0A\00"
@.str.14 = [17 x i8] c" (rNAD) values('\00"
@.str.15 = [3 x i8] c"')\00"
@.str.16 = [12 x i8] c"Query: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [400 x i8]
%4 = alloca [400 x i8]
%5 = alloca [25 x i8]
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8**
%11 = alloca i8**
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca [27 x i8]
store i32 0, i32* %1
%18 = bitcast [400 x i8]* %3 to i8*
%19 = bitcast [400 x i8]* %4 to i8*
%20 = bitcast [25 x i8]* %5 to i8*
store i32 0, i32* %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%22 = call i32* @mysql_init(i32* null)
store i32* %22, i32** %6
%23 = call i32* @mysql_init(i32* null)
store i32* %23, i32** %7
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %14
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %15
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %16
%24 = load i32*, i32** %6
%25 = load i8*, i8** %13
%26 = load i8*, i8** %14
%27 = load i8*, i8** %15
%28 = load i8*, i8** %16
%29 = call i32 @mysql_real_connect(i32* %24, i8* %25, i8* %26, i8* %27, i8* %28, i32 0, i32* null, i32 0)
%30 = icmp ne i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %0
%32 = load i32*, i32** %6
%33 = call i8* @mysql_error(i32* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %33)
store i32 1, i32* %1
br label %98
35: ; preds = %0
%36 = load i32*, i32** %7
%37 = load i8*, i8** %13
%38 = load i8*, i8** %14
%39 = load i8*, i8** %15
%40 = load i8*, i8** %16
%41 = call i32 @mysql_real_connect(i32* %36, i8* %37, i8* %38, i8* %39, i8* %40, i32 0, i32* null, i32 0)
%42 = icmp ne i32 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %35
%44 = load i32*, i32** %7
%45 = call i8* @mysql_error(i32* %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %45)
store i32 1, i32* %1
br label %98
47: ; preds = %35
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0))
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %2)
%51 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%52 = call i32 @strcat(i8* %51, i8* %2)
%53 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%54 = call i32 @strcat(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%55 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), i8* %55)
%57 = bitcast [27 x i8]* %17 to i8*
%58 = load i32*, i32** %6
%59 = getelementptr inbounds [27 x i8], [27 x i8]* %17, i64 0, i64 0
%60 = call i32 @mysql_query(i32* %58, i8* %59)
store i32 %60, i32* %12
%61 = load i32, i32* %12
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %47
%64 = load i32*, i32** %6
%65 = call i8* @mysql_error(i32* %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0), i8* %65)
store i32 1, i32* %1
br label %98
67: ; preds = %47
%68 = load i32*, i32** %6
%69 = call i32* @mysql_use_result(i32* %68)
store i32* %69, i32** %8
%70 = load i32*, i32** %8
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0))
br label %74
74: ; preds = %72, %67
br label %75
75: ; preds = %79, %74
%76 = load i32*, i32** %8
%77 = call i8** @mysql_fetch_row(i32* %76)
store i8** %77, i8*** %10
%78 = icmp ne i8** %77, null
br i1 %78, label %79, label %97
79: ; preds = %75
%80 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%81 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%82 = call i32 @strcat(i8* %80, i8* %81)
%83 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%84 = call i32 @strcat(i8* %83, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%85 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%86 = load i8**, i8*** %10
%87 = getelementptr inbounds i8*, i8** %86, i64 0
%88 = load i8*, i8** %87
%89 = call i32 @strcat(i8* %85, i8* %88)
%90 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%91 = call i32 @strcat(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%92 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %92)
%94 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%95 = getelementptr inbounds [400 x i8], [400 x i8]* %4, i64 0, i64 0
%96 = call i32 @strcpy(i8* %94, i8* %95)
br label %75
97: ; preds = %75
store i32 0, i32* %1
br label %98
98: ; preds = %97, %63, %43, %31
%99 = load i32, i32* %1
ret i32 %99
}

LLVM IR (-O2):
@__const.main.queryInit = [400 x i8] c"INSERT INTO\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.attendSHEET = [25 x i8] c"attendanceSheet\00\00\00\00\00\00\00\00\00\00"
@.str = [27 x i8] c"Connecting to Database....\00"
@.str.1 = [10 x i8] c"localhost\00"
@.str.2 = [5 x i8] c"root\00"
@.str.3 = [5 x i8] c"omni\00"
@.str.4 = [13 x i8] c"omniPresence\00"
@.str.5 = [41 x i8] c"UNABLE TO CONTACT WORKERS DATABASE...%s\0A\00"
@.str.6 = [41 x i8] c"UNABLE TO CONNECT ATTENDANCE SHEET...%s\0A\00"
@.str.8 = [60 x i8] c"Please Enter the month for which the rNad is to be created:\00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [3 x i8] c"09\00"
@.str.11 = [32 x i8] c"AttendanceSheet Selected is %s\0A\00"
@__const.main.queryWD = [27 x i8] c"SELECT rNad FROM workersDB\00"
@.str.12 = [41 x i8] c"ERROR IN PARSING QUERY TO DATABASE...%s\0A\00"
@.str.14 = [17 x i8] c" (rNAD) values('\00"
@.str.15 = [3 x i8] c"')\00"
@.str.16 = [12 x i8] c"Query: %s\0A\00"
@str = [5 x i8] c"done\00"
@str.17 = [29 x i8] c"NO RESULT RETURNED BY QUERY.\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [400 x i8]
%3 = alloca [400 x i8]
%4 = alloca [25 x i8]
%5 = alloca [27 x i8]
%6 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32* @mysql_init(i32* null)
%11 = tail call i32* @mysql_init(i32* null)
%12 = tail call i32 @mysql_real_connect(i32* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 0, i32* null, i32 0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = tail call i8* @mysql_error(i32* %10)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %15)
br label %57
17: ; preds = %0
%18 = tail call i32 @mysql_real_connect(i32* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 0, i32* null, i32 0)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = tail call i8* @mysql_error(i32* %11)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %21)
br label %57
23: ; preds = %17
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %1)
%27 = call i32 @strcat(i8* %8, i8* %1)
%28 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), i8* %8)
%30 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%31 = call i32 @mysql_query(i32* %10, i8* %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %23
%34 = call i8* @mysql_error(i32* %10)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0), i8* %34)
br label %55
36: ; preds = %23
%37 = call i32* @mysql_use_result(i32* %10)
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.17, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = call i8** @mysql_fetch_row(i32* %37)
%43 = icmp eq i8** %42, null
br i1 %43, label %55, label %44
44: ; preds = %41, %44
%45 = phi i8** [ %53, %44 ], [ %42, %41 ]
%46 = call i32 @strcat(i8* %6, i8* %8)
%47 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%48 = load i8*, i8** %45
%49 = call i32 @strcat(i8* %6, i8* %48)
%50 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %6)
%52 = call i32 @strcpy(i8* %6, i8* %7)
%53 = call i8** @mysql_fetch_row(i32* %37)
%54 = icmp eq i8** %53, null
br i1 %54, label %55, label %44
55: ; preds = %44, %41, %33
%56 = phi i32 [ 1, %33 ], [ 0, %41 ], [ 0, %44 ]
br label %57
57: ; preds = %55, %20, %14
%58 = phi i32 [ %56, %55 ], [ 1, %20 ], [ 1, %14 ]
ret i32 %58
}