#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*/ buff;
typedef int /*<<< orphan*/ basename;

/* Variables and functions */
int /*<<< orphan*/ file_basename(char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strdup(char *);
char *gettranslatename(char *name) {
  char buff[256];
  char basename[256];
  memset(basename, 0, sizeof(basename));
  memset(buff, 0, sizeof(buff));
  file_basename(name, basename);
  sprintf(buff, "preeql%s.cob", basename);
  return strdup(buff);
}


x86 assembly (clang, -O0):
<gettranslatename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <file_basename@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xe66(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <strdup@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettranslatename>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    0x100(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <file_basename@plt>
lea    0xe76(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %r15,%rdi
call   1060 <strdup@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"preeql%s.cob\00"
define i8* @gettranslatename(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 256)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 256)
%9 = load i8*, i8** %2
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%11 = call i32 @file_basename(i8* %9, i8* %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%16 = call i8* @strdup(i8* %15)
ret i8* %16
}

LLVM IR (-O2):
@.str = [13 x i8] c"preeql%s.cob\00"
define noalias i8* @gettranslatename(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 256)
%7 = call i32 @memset(i8* %4, i32 0, i32 256)
%8 = call i32 @file_basename(i8* %0, i8* %5)
%9 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5)
%10 = call i8* @strdup(i8* %4)
ret i8* %10
}