#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
char *f(char *s) {
  char t[50];
  (void)system("test");
  strcpy(t, "test");
  (void)system(t);
  strcat(t, s);
  (void)system(t);
  strcpy(t, s);
  (void)system(t);
  return t;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <system@plt>
lea    -0x40(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1040 <system@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x40(%rbp),%rdi
call   1040 <system@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1040 <system@plt>
lea    -0x40(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%r15
lea    0xebd(%rip),%r14
mov    %r14,%rdi
call   1040 <system@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
define i8* @f(i8* %0) {
%2 = alloca i8*
%3 = alloca [50 x i8]
store i8* %0, i8** %2
%4 = call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = call i32 @system(i8* %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i32 @strcat(i8* %9, i8* %10)
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%13 = call i32 @system(i8* %12)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%15 = load i8*, i8** %2
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%18 = call i32 @system(i8* %17)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
ret i8* %19
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i8* @f(i8* %0) {
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @system(i8* %3)
%7 = call i32 @strcat(i8* %3, i8* %0)
%8 = call i32 @system(i8* %3)
%9 = call i32 @strcpy(i8* %3, i8* %0)
%10 = call i32 @system(i8* %3)
ret i8* %3
}