#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 getpid();
int /*<<< orphan*/ sprintf(char *, char *, ...);
int system(char *);
int make_entries_uniq(char *fname) {
  char tempfile[512];
  char commline[7000];
  sprintf(tempfile, "regtmp1%d", getpid());
  sprintf(commline, "%s < %s > %s ; %s %s %s ", "/bin/sort -u", fname, tempfile,
          "/bin/mv", tempfile, fname);
  return (system(commline));
}


x86 assembly (clang, -O0):
<make_entries_uniq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rax
mov    %rax,-0x1d78(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x1d78(%rbp),%rdi
mov    %eax,%edx
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x1d70(%rbp),%rdi
mov    -0x8(%rbp),%rcx
lea    -0x210(%rbp),%r8
lea    -0x210(%rbp),%r10
mov    -0x8(%rbp),%rax
lea    0xe7b(%rip),%rsi
lea    0xe8d(%rip),%rdx
lea    0xe93(%rip),%r9
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x1d70(%rbp),%rdi
call   1040 <system@plt>
add    $0x1d90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_entries_uniq>:
push   %r15
push   %r14
push   %rbx
sub    $0x1d60,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb3(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
lea    0xea7(%rip),%rsi
lea    0xeb9(%rip),%rdx
lea    0xebf(%rip),%r9
lea    0x200(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rcx
mov    %r14,%r8
xor    %eax,%eax
push   %rbx
push   %r14
call   1050 <sprintf@plt>
add    $0x10,%rsp
mov    %r15,%rdi
call   1040 <system@plt>
add    $0x1d60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"regtmp1%d\00"
@.str.1 = [25 x i8] c"%s < %s > %s ; %s %s %s \00"
@.str.2 = [13 x i8] c"/bin/sort -u\00"
@.str.3 = [8 x i8] c"/bin/mv\00"
define i32 @make_entries_uniq(i8* %0) {
%2 = alloca i8*
%3 = alloca [512 x i8]
%4 = alloca [7000 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = call i32 (...) @getpid()
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [7000 x i8], [7000 x i8]* %4, i64 0, i64 0
%9 = load i8*, i8** %2
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%12 = load i8*, i8** %2
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %11, i8* %12)
%14 = getelementptr inbounds [7000 x i8], [7000 x i8]* %4, i64 0, i64 0
%15 = call i32 @system(i8* %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [10 x i8] c"regtmp1%d\00"
@.str.1 = [25 x i8] c"%s < %s > %s ; %s %s %s \00"
@.str.2 = [13 x i8] c"/bin/sort -u\00"
@.str.3 = [8 x i8] c"/bin/mv\00"
define i32 @make_entries_uniq(i8* %0) {
%2 = alloca [512 x i8]
%3 = alloca [7000 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [7000 x i8], [7000 x i8]* %3, i64 0, i64 0
%6 = tail call i32 (...) @getpid()
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %4, i8* %0)
%9 = call i32 @system(i8* %5)
ret i32 %9
}