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

/* Variables and functions */
int /*<<< orphan*/ add_makefile_entry_to_file(char *, char *, char *);
int empty_makefile_section(char *, char *);
int /*<<< orphan*/ get_setting(char *, char *);
scalar_t__ is_library(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char);
scalar_t__ strcmp(char *, char *);
void save_makefile_java(char *filename) {
  char str[512];
  char project_type[512];
  char project_name[512];
  char compile_args[512];
  char sourcedir[512];
  char build_dir[512];
  get_setting("project name", project_name);
  get_setting("project type", project_type);
  get_setting("compile", compile_args);
  get_setting("source dir", sourcedir);
  get_setting("build dir", build_dir);
  if (strcmp(project_type, "java") == 0) {
    if (is_library(project_name) == 0) {
      if (empty_makefile_section(filename, "all") == 1) {
        sprintf(str, "javac %s -d %s -sourcepath %s %s%c${APP}.java",
                compile_args, build_dir, sourcedir, sourcedir, '/');
        add_makefile_entry_to_file(filename, "all", str);
      }
      if (empty_makefile_section(filename, "debug") == 1) {
        sprintf(str, "javac %s -d %s -sourcepath %s %s%c${APP}.java",
                compile_args, build_dir, sourcedir, sourcedir, '/');
        add_makefile_entry_to_file(filename, "debug", str);
      }
    } else {
    }
  }
}


x86 assembly (clang, -O0):
<save_makefile_java>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x610(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1040 <get_setting@plt>
lea    -0x410(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <get_setting@plt>
lea    -0x810(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1040 <get_setting@plt>
lea    -0xa10(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1040 <get_setting@plt>
lea    -0xc10(%rbp),%rsi
lea    0xe64(%rip),%rdi
call   1040 <get_setting@plt>
lea    -0x410(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12dc <save_makefile_java+0x17c>
lea    -0x610(%rbp),%rdi
call   1050 <is_library@plt>
cmp    $0x0,%rax
jne    12d2 <save_makefile_java+0x172>
mov    -0x8(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1060 <empty_makefile_section@plt>
cmp    $0x1,%eax
jne    1267 <save_makefile_java+0x107>
lea    -0x210(%rbp),%rdi
lea    -0x810(%rbp),%rdx
lea    -0xc10(%rbp),%rcx
lea    -0xa10(%rbp),%r8
lea    -0xa10(%rbp),%r9
lea    0xdf7(%rip),%rsi
movl   $0x2f,(%rsp)
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xdd5(%rip),%rsi
call   1080 <add_makefile_entry_to_file@plt>
mov    -0x8(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1060 <empty_makefile_section@plt>
cmp    $0x1,%eax
jne    12cd <save_makefile_java+0x16d>
lea    -0x210(%rbp),%rdi
lea    -0x810(%rbp),%rdx
lea    -0xc10(%rbp),%rcx
lea    -0xa10(%rbp),%r8
lea    -0xa10(%rbp),%r9
lea    0xd91(%rip),%rsi
movl   $0x2f,(%rsp)
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xda1(%rip),%rsi
call   1080 <add_makefile_entry_to_file@plt>
jmp    12d7 <save_makefile_java+0x177>
jmp    12d7 <save_makefile_java+0x177>
jmp    12dc <save_makefile_java+0x17c>
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_makefile_java>:
push   %r14
push   %rbx
sub    $0xc18,%rsp
mov    %rdi,%r14
lea    0xe8c(%rip),%rdi
lea    0x610(%rsp),%rsi
call   1040 <get_setting@plt>
lea    0xe85(%rip),%rdi
lea    0xa10(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <get_setting@plt>
lea    0xe7b(%rip),%rdi
lea    0x410(%rsp),%rsi
call   1040 <get_setting@plt>
lea    0xe6f(%rip),%rdi
lea    0x210(%rsp),%rsi
call   1040 <get_setting@plt>
lea    0xe66(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <get_setting@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    12b7 <save_makefile_java+0x157>
lea    0x610(%rsp),%rdi
call   1050 <is_library@plt>
test   %rax,%rax
jne    12b7 <save_makefile_java+0x157>
lea    0xe31(%rip),%rsi
mov    %r14,%rdi
call   1060 <empty_makefile_section@plt>
cmp    $0x1,%eax
jne    125b <save_makefile_java+0xfb>
movl   $0x2f,(%rsp)
lea    0xe1a(%rip),%rsi
lea    0x810(%rsp),%rbx
lea    0x410(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x210(%rsp),%r8
mov    %rbx,%rdi
mov    %r8,%r9
call   1070 <sprintf@plt>
lea    0xde7(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <add_makefile_entry_to_file@plt>
lea    0xe07(%rip),%rsi
mov    %r14,%rdi
call   1060 <empty_makefile_section@plt>
cmp    $0x1,%eax
jne    12b7 <save_makefile_java+0x157>
movl   $0x2f,(%rsp)
lea    0xdbe(%rip),%rsi
lea    0x810(%rsp),%rbx
lea    0x410(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x210(%rsp),%r8
mov    %rbx,%rdi
mov    %r8,%r9
call   1070 <sprintf@plt>
lea    0xdbd(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <add_makefile_entry_to_file@plt>
add    $0xc18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"project name\00"
@.str.1 = [13 x i8] c"project type\00"
@.str.2 = [8 x i8] c"compile\00"
@.str.3 = [11 x i8] c"source dir\00"
@.str.4 = [10 x i8] c"build dir\00"
@.str.5 = [5 x i8] c"java\00"
@.str.6 = [4 x i8] c"all\00"
@.str.7 = [46 x i8] c"javac %s -d %s -sourcepath %s %s%c${APP}.java\00"
@.str.8 = [6 x i8] c"debug\00"
define void @save_makefile_java(i8* %0) {
%2 = alloca i8*
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
store i8* %0, i8** %2
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = call i32 @get_setting(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%12 = call i32 @get_setting(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%14 = call i32 @get_setting(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%16 = call i32 @get_setting(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%18 = call i32 @get_setting(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %57
22: ; preds = %1
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%24 = call i64 @is_library(i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %55
26: ; preds = %22
%27 = load i8*, i8** %2
%28 = call i32 @empty_makefile_section(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%36 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i8* %32, i8* %33, i8* %34, i8* %35, i8 signext 47)
%37 = load i8*, i8** %2
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%39 = call i32 @add_makefile_entry_to_file(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %30, %26
%41 = load i8*, i8** %2
%42 = call i32 @empty_makefile_section(i8* %41, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %54
44: ; preds = %40
%45 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%49 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%50 = call i32 @sprintf(i8* %45, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i8* %46, i8* %47, i8* %48, i8* %49, i8 signext 47)
%51 = load i8*, i8** %2
%52 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%53 = call i32 @add_makefile_entry_to_file(i8* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %52)
br label %54
54: ; preds = %44, %40
br label %56
55: ; preds = %22
br label %56
56: ; preds = %55, %54
br label %57
57: ; preds = %56, %1
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"project name\00"
@.str.1 = [13 x i8] c"project type\00"
@.str.2 = [8 x i8] c"compile\00"
@.str.3 = [11 x i8] c"source dir\00"
@.str.4 = [10 x i8] c"build dir\00"
@.str.5 = [5 x i8] c"java\00"
@.str.6 = [4 x i8] c"all\00"
@.str.7 = [46 x i8] c"javac %s -d %s -sourcepath %s %s%c${APP}.java\00"
@.str.8 = [6 x i8] c"debug\00"
define void @save_makefile_java(i8* %0) {
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = call i32 @get_setting(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %10)
%15 = call i32 @get_setting(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%16 = call i32 @get_setting(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%17 = call i32 @get_setting(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%18 = call i32 @get_setting(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%19 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %36
21: ; preds = %1
%22 = call i64 @is_library(i8* %10)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %36
24: ; preds = %21
%25 = call i32 @empty_makefile_section(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i8* %11, i8* %13, i8* %12, i8* %12, i8 signext 47)
%29 = call i32 @add_makefile_entry_to_file(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %8)
br label %30
30: ; preds = %27, %24
%31 = call i32 @empty_makefile_section(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i8* %11, i8* %13, i8* %12, i8* %12, i8 signext 47)
%35 = call i32 @add_makefile_entry_to_file(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %8)
br label %36
36: ; preds = %33, %30, %21, %1
ret void
}