#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 *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void write_basic_dao_file() {
  FILE *file_out;
  char file_out_name[500];
  strcpy(file_out_name, "BasicDAO.java");
  char folder_name[500];
  strcpy(folder_name, "DAO/");
  strcat(folder_name, file_out_name);
  file_out = fopen(folder_name, "w");
  fprintf(file_out, "import java.sql.Connection;\n");
  fprintf(file_out, "import java.sql.DriverManager;\n\n");
  fprintf(file_out, "public class BasicDAO {\n\n");
  fprintf(file_out,
          "\tprotected static String databaseLocate = \"jdbc:mysql://\";\n");
  fprintf(file_out, "\tprotected static String serverName = \"localhost\";\n");
  fprintf(file_out, "\tprotected static String databaseName = \"test\";\n");
  fprintf(file_out, "\tprotected static String user = \"root\";\n");
  fprintf(file_out, "\tprotected static String password = \"root\";\n\n");
  fprintf(file_out, "\tprotected Connection conn = "
                    "DriverManager.getConnection(databaseLocate + serverName + "
                    "\"/\" + databaseName, user, password);\n\n");
  fprintf(file_out, "}");
  fclose(file_out);
}


x86 assembly (clang, -O0):
<write_basic_dao_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    -0x200(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x400(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x400(%rbp),%rdi
lea    -0x200(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x400(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xed7(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xef8(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf11(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf2f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf9d(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_basic_dao_file>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
lea    0xe8f(%rip),%rsi
lea    0x200(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xe86(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe6e(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe5e(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
lea    0xe62(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe6a(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe6b(%rip),%rdi
mov    $0x3b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe8e(%rip),%rdi
mov    $0x33,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xea9(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xec1(%rip),%rdi
mov    $0x28,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xed1(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xee6(%rip),%rdi
mov    $0x7d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
mov    $0x7d,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"BasicDAO.java\00"
@.str.1 = [5 x i8] c"DAO/\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [29 x i8] c"import java.sql.Connection;\0A\00"
@.str.4 = [33 x i8] c"import java.sql.DriverManager;\0A\0A\00"
@.str.5 = [26 x i8] c"public class BasicDAO {\0A\0A\00"
@.str.6 = [60 x i8] c"\09protected static String databaseLocate = \22jdbc:mysql://\22;\0A\00"
@.str.7 = [52 x i8] c"\09protected static String serverName = \22localhost\22;\0A\00"
@.str.8 = [49 x i8] c"\09protected static String databaseName = \22test\22;\0A\00"
@.str.9 = [41 x i8] c"\09protected static String user = \22root\22;\0A\00"
@.str.10 = [46 x i8] c"\09protected static String password = \22root\22;\0A\0A\00"
@.str.11 = [126 x i8] c"\09protected Connection conn = DriverManager.getConnection(databaseLocate + serverName + \22/\22 + databaseName, user, password);\0A\0A\00"
@.str.12 = [2 x i8] c"}\00"
define void @write_basic_dao_file() {
%1 = alloca i32*
%2 = alloca [500 x i8]
%3 = alloca [500 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %12, i32** %1
%13 = load i32*, i32** %1
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32*, i32** %1
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32*, i32** %1
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%19 = load i32*, i32** %1
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%21 = load i32*, i32** %1
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%23 = load i32*, i32** %1
%24 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%25 = load i32*, i32** %1
%26 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0))
%27 = load i32*, i32** %1
%28 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0))
%29 = load i32*, i32** %1
%30 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str.11, i64 0, i64 0))
%31 = load i32*, i32** %1
%32 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%33 = load i32*, i32** %1
%34 = call i32 @fclose(i32* %33)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"BasicDAO.java\00"
@.str.1 = [5 x i8] c"DAO/\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [29 x i8] c"import java.sql.Connection;\0A\00"
@.str.4 = [33 x i8] c"import java.sql.DriverManager;\0A\0A\00"
@.str.5 = [26 x i8] c"public class BasicDAO {\0A\0A\00"
@.str.6 = [60 x i8] c"\09protected static String databaseLocate = \22jdbc:mysql://\22;\0A\00"
@.str.7 = [52 x i8] c"\09protected static String serverName = \22localhost\22;\0A\00"
@.str.8 = [49 x i8] c"\09protected static String databaseName = \22test\22;\0A\00"
@.str.9 = [41 x i8] c"\09protected static String user = \22root\22;\0A\00"
@.str.10 = [46 x i8] c"\09protected static String password = \22root\22;\0A\0A\00"
@.str.11 = [126 x i8] c"\09protected Connection conn = DriverManager.getConnection(databaseLocate + serverName + \22/\22 + databaseName, user, password);\0A\0A\00"
define void @write_basic_dao_file() {
%1 = alloca [500 x i8]
%2 = alloca [500 x i8]
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @strcat(i8* %5, i8* %3)
%8 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i64 28, i64 1, i32* %8)
%10 = call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i64 32, i64 1, i32* %8)
%11 = call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i64 25, i64 1, i32* %8)
%12 = call i64 @fwrite(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i64 59, i64 1, i32* %8)
%13 = call i64 @fwrite(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i64 51, i64 1, i32* %8)
%14 = call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i64 48, i64 1, i32* %8)
%15 = call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i64 40, i64 1, i32* %8)
%16 = call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i64 45, i64 1, i32* %8)
%17 = call i64 @fwrite(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str.11, i64 0, i64 0), i64 125, i64 1, i32* %8)
%18 = call i32 @fputc(i32 125, i32* %8)
%19 = call i32 @fclose(i32* %8)
ret void
}