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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ system(char *);
void createTable(char *tableName) {
  char query[1500];
  sprintf(
      query,
      "CREATE TABLE %s (sno bigint, datelog varchar(50), timelog varchar(50), "
      "taskTotal int, taskRunning int, taskSleeping int, taskStopped int, "
      "taskZombie int, memTotal float, memUsed float, memFree float, memBuffer "
      "float, swapTotal float, swapUsed float, swapFree float, swapCached "
      "float, pid int, ppid int, user varchar(50), tty varchar(10), pr "
      "varchar(10), ni varchar(5), nflt varchar(5), virt float, res float, shr "
      "float, ndrt varchar(10), wchan varchar(50), flags varchar(10), state "
      "varchar(10), cpuPerc decimal(4,4), memPerc decimal(4,4), timeUsed "
      "varchar(50), pValue varchar(10), command varchar(255));",
      tableName);
  FILE *newfp = fopen("createTable.sql", "w");
  fprintf(newfp, "%s", query);
  fclose(newfp);
  char sqlCommand[150];
  sprintf(sqlCommand,
          "mysql -h hydra-cyborgmother.nectechnologies.in -u necbuilder "
          "--password='necbuilder@123' actlog_top < createTable.sql");
  system(sqlCommand);
}


x86 assembly (clang, -O0):
<createTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x690,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x5f0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    0x1148(%rip),%rdi
lea    0x10d6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x5f8(%rbp)
mov    -0x5f8(%rbp),%rdi
lea    -0x5f0(%rbp),%rdx
lea    0x10b7(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x5f8(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x690(%rbp),%rdi
lea    0x109b(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x690(%rbp),%rdi
call   1040 <system@plt>
add    $0x690,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createTable>:
push   %r14
push   %rbx
sub    $0x688,%rsp
mov    %rdi,%rdx
lea    0xe9c(%rip),%rsi
lea    0xa0(%rsp),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <sprintf@plt>
lea    0x1147(%rip),%rdi
lea    0x10d8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
movups 0x1118(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movups 0x10fc(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0x10e0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0x10c4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movups 0x10a8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0x108c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0x1070(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x6c71732e656c62,%rax
mov    %rax,0x6e(%rsp)
mov    %rsp,%rdi
call   1040 <system@plt>
add    $0x688,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [604 x i8] c"CREATE TABLE %s (sno bigint, datelog varchar(50), timelog varchar(50), taskTotal int, taskRunning int, taskSleeping int, taskStopped int, taskZombie int, memTotal float, memUsed float, memFree float, memBuffer float, swapTotal float, swapUsed float, swapFree float, swapCached float, pid int, ppid int, user varchar(50), tty varchar(10), pr varchar(10), ni varchar(5), nflt varchar(5), virt float, res float, shr float, ndrt varchar(10), wchan varchar(50), flags varchar(10), state varchar(10), cpuPerc decimal(4,4), memPerc decimal(4,4), timeUsed varchar(50), pValue varchar(10), command varchar(255));\00"
@.str.1 = [16 x i8] c"createTable.sql\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [118 x i8] c"mysql -h hydra-cyborgmother.nectechnologies.in -u necbuilder --password='necbuilder@123' actlog_top < createTable.sql\00"
define void @createTable(i8* %0) {
%2 = alloca i8*
%3 = alloca [1500 x i8]
%4 = alloca i32*
%5 = alloca [150 x i8]
store i8* %0, i8** %2
%6 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([604 x i8], [604 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %9, i32** %4
%10 = load i32*, i32** %4
%11 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 0
%12 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%13 = load i32*, i32** %4
%14 = call i32 @fclose(i32* %13)
%15 = getelementptr inbounds [150 x i8], [150 x i8]* %5, i64 0, i64 0
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str.4, i64 0, i64 0))
%17 = getelementptr inbounds [150 x i8], [150 x i8]* %5, i64 0, i64 0
%18 = call i32 @system(i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [604 x i8] c"CREATE TABLE %s (sno bigint, datelog varchar(50), timelog varchar(50), taskTotal int, taskRunning int, taskSleeping int, taskStopped int, taskZombie int, memTotal float, memUsed float, memFree float, memBuffer float, swapTotal float, swapUsed float, swapFree float, swapCached float, pid int, ppid int, user varchar(50), tty varchar(10), pr varchar(10), ni varchar(5), nflt varchar(5), virt float, res float, shr float, ndrt varchar(10), wchan varchar(50), flags varchar(10), state varchar(10), cpuPerc decimal(4,4), memPerc decimal(4,4), timeUsed varchar(50), pValue varchar(10), command varchar(255));\00"
@.str.1 = [16 x i8] c"createTable.sql\00"
@.str.2 = [2 x i8] c"w\00"
@.str.4 = [118 x i8] c"mysql -h hydra-cyborgmother.nectechnologies.in -u necbuilder --password='necbuilder@123' actlog_top < createTable.sql\00"
define void @createTable(i8* %0) {
%2 = alloca [1500 x i8]
%3 = alloca [150 x i8]
%4 = getelementptr inbounds [1500 x i8], [1500 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([604 x i8], [604 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @fputs(i8* %4, i32* %6)
%8 = tail call i32 @fclose(i32* %6)
%9 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%10 = call i32 @system(i8* %9)
ret void
}