#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 _get_int_random_number(int /*<<< orphan*/ *);
int /*<<< orphan*/ int2str(char *, int *);
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
void set_random_file_name(char *file_name, __const char *prefix,
                          __const char *sufix) {
  int random_number, max_int;
  char aux[100];
  random_number = _get_int_random_number(NULL);
  int2str(aux, &random_number);
  if (prefix != NULL) {
    strcpy(file_name, prefix);
    strcat(file_name, aux);
  } else {
    strcpy(file_name, aux);
  }
  if (sufix != NULL) {
    strcat(file_name, sufix);
  }
}


x86 assembly (clang, -O0):
<set_random_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <_get_int_random_number@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <int2str@plt>
cmpq   $0x0,-0x10(%rbp)
je     11a0 <set_random_file_name+0x60>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <strcat@plt>
jmp    11b0 <set_random_file_name+0x70>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcpy@plt>
cmpq   $0x0,-0x18(%rbp)
je     11c8 <set_random_file_name+0x88>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_random_file_name>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %edi,%edi
call   1050 <_get_int_random_number@plt>
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <int2str@plt>
test   %rbx,%rbx
je     11a9 <set_random_file_name+0x69>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1060 <strcat@plt>
test   %r14,%r14
je     119c <set_random_file_name+0x5c>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1040 <strcpy@plt>
test   %r14,%r14
jne    1191 <set_random_file_name+0x51>
jmp    119c <set_random_file_name+0x5c>

LLVM IR (-O0):
define void @set_random_file_name(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%10 = call i32 @_get_int_random_number(i32* null)
store i32 %10, i32* %7
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%12 = call i32 @int2str(i8* %11, i32* %7)
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %22
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %4
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%21 = call i32 @strcat(i8* %19, i8* %20)
br label %26
22: ; preds = %3
%23 = load i8*, i8** %4
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%25 = call i32 @strcpy(i8* %23, i8* %24)
br label %26
26: ; preds = %22, %15
%27 = load i8*, i8** %6
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i8*, i8** %4
%31 = load i8*, i8** %6
%32 = call i32 @strcat(i8* %30, i8* %31)
br label %33
33: ; preds = %29, %26
ret void
}

LLVM IR (-O2):
define void @set_random_file_name(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%8 = tail call i32 @_get_int_random_number(i32* null)
store i32 %8, i32* %4
%9 = call i32 @int2str(i8* %7, i32* %4)
%10 = icmp eq i8* %1, null
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = call i32 @strcpy(i8* %0, i8* %1)
%13 = call i32 @strcat(i8* %0, i8* %7)
br label %16
14: ; preds = %3
%15 = call i32 @strcpy(i8* %0, i8* %7)
br label %16
16: ; preds = %14, %11
%17 = icmp eq i8* %2, null
br i1 %17, label %20, label %18
18: ; preds = %16
%19 = call i32 @strcat(i8* %0, i8* %2)
br label %20
20: ; preds = %18, %16
ret void
}