#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*/ capitalize_name(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *write_file_name(char name_array[][500], char type) {
  static char file_out_name[500], source_string[500];
  strcpy(file_out_name, name_array[0]);
  capitalize_name(file_out_name);
  if (type == 'm') {
    strcpy(source_string, ".java");
  } else {
    strcpy(source_string, "DAO.java");
  }
  strcat(file_out_name, source_string);
  return file_out_name;
}


x86 assembly (clang, -O0):
<write_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f03(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2ef7(%rip),%rdi
call   1040 <capitalize_name@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x6d,%eax
jne    1183 <write_file_name+0x53>
lea    0x30de(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1196 <write_file_name+0x66>
lea    0x30c6(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2eb3(%rip),%rdi
lea    0x30ac(%rip),%rsi
call   1050 <strcat@plt>
lea    0x2ea0(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_file_name>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0x2f10(%rip),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1040 <capitalize_name@plt>
cmp    $0x6d,%bl
lea    0xea9(%rip),%rax
lea    0xe9f(%rip),%rsi
cmove  %rax,%rsi
lea    0x30e4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@write_file_name.file_out_name = internal global [500 x i8] zeroinitializer
@write_file_name.source_string = internal global [500 x i8] zeroinitializer
@.str = [6 x i8] c".java\00"
@.str.1 = [9 x i8] c"DAO.java\00"
define i8* @write_file_name([500 x i8]* %0, i8 signext %1) {
%3 = alloca [500 x i8]*
%4 = alloca i8
store [500 x i8]* %0, [500 x i8]** %3
store i8 %1, i8* %4
%5 = load [500 x i8]*, [500 x i8]** %3
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%8 = call i32 @strcpy(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0), i8* %7)
%9 = call i32 @capitalize_name(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0))
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 109
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @strcpy(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.source_string, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %17
15: ; preds = %2
%16 = call i32 @strcpy(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.source_string, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = call i32 @strcat(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0), i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.source_string, i64 0, i64 0))
ret i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0)
}

LLVM IR (-O2):
@write_file_name.file_out_name = internal global [500 x i8] zeroinitializer
@write_file_name.source_string = internal global [500 x i8] zeroinitializer
@.str = [6 x i8] c".java\00"
@.str.1 = [9 x i8] c"DAO.java\00"
define i8* @write_file_name([500 x i8]* %0, i8 signext %1) {
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %0, i64 0, i64 0
%4 = tail call i32 @strcpy(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0), i8* %3)
%5 = tail call i32 @capitalize_name(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0))
%6 = icmp eq i8 %1, 109
%7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @strcpy(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.source_string, i64 0, i64 0), i8* %7)
%9 = tail call i32 @strcat(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0), i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.source_string, i64 0, i64 0))
ret i8* getelementptr inbounds ([500 x i8], [500 x i8]* @write_file_name.file_out_name, i64 0, i64 0)
}