#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*/ static_log_data_filename;
typedef int /*<<< orphan*/ full_static_log_data_filename;
typedef int /*<<< orphan*/ full_dynamic_trace_filename;
typedef int /*<<< orphan*/ dynamic_trace_filename;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int unlink(char *);
int delete_shm_files(unsigned short pid) {
  char dynamic_trace_filename[0x100];
  char static_log_data_filename[0x100];
  char full_dynamic_trace_filename[0x100];
  char full_static_log_data_filename[0x100];
  int rc;
  snprintf(dynamic_trace_filename, sizeof(dynamic_trace_filename),
           "_trace_shm_%d_dynamic_trace_data", pid);
  snprintf(static_log_data_filename, sizeof(static_log_data_filename),
           "_trace_shm_%d_static_trace_metadata", pid);
  snprintf(full_dynamic_trace_filename, sizeof(full_dynamic_trace_filename),
           "%s/%s", "/dev/shm/", dynamic_trace_filename);
  snprintf(full_static_log_data_filename, sizeof(full_static_log_data_filename),
           "%s/%s", "/dev/shm/", static_log_data_filename);
  rc = unlink(full_dynamic_trace_filename);
  rc |= unlink(full_static_log_data_filename);
  return rc;
}


x86 assembly (clang, -O0):
<delete_shm_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x110(%rbp),%rdi
movzwl -0x2(%rbp),%ecx
mov    $0x100,%esi
lea    0xeb7(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0x210(%rbp),%rdi
movzwl -0x2(%rbp),%ecx
mov    $0x100,%esi
lea    0xeba(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0x310(%rbp),%rdi
lea    -0x110(%rbp),%r8
mov    $0x100,%esi
lea    0xebd(%rip),%rdx
lea    0xebc(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0x410(%rbp),%rdi
lea    -0x210(%rbp),%r8
mov    $0x100,%esi
lea    0xe95(%rip),%rdx
lea    0xe94(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0x310(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <unlink@plt>
or     -0x414(%rbp),%eax
mov    %eax,-0x414(%rbp)
mov    -0x414(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_shm_files>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %edi,%ebx
lea    0xec7(%rip),%rdx
lea    0x300(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
lea    0xec8(%rip),%rdx
lea    0x200(%rsp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
lea    0xecc(%rip),%rbx
lea    0xecb(%rip),%r12
lea    0x100(%rsp),%r13
mov    %r13,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %r13,%rdi
call   1030 <unlink@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <unlink@plt>
or     %ebx,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"_trace_shm_%d_dynamic_trace_data\00"
@.str.1 = [36 x i8] c"_trace_shm_%d_static_trace_metadata\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@.str.3 = [10 x i8] c"/dev/shm/\00"
define i32 @delete_shm_files(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca i32
store i16 %0, i16* %2
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %8, i32 256, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%13 = load i16, i16* %2
%14 = zext i16 %13 to i32
%15 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %12, i32 256, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%18 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %16, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%21 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %19, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%23 = call i32 @unlink(i8* %22)
store i32 %23, i32* %7
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%25 = call i32 @unlink(i8* %24)
%26 = load i32, i32* %7
%27 = or i32 %26, %25
store i32 %27, i32* %7
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
@.str = [33 x i8] c"_trace_shm_%d_dynamic_trace_data\00"
@.str.1 = [36 x i8] c"_trace_shm_%d_static_trace_metadata\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@.str.3 = [10 x i8] c"/dev/shm/\00"
define i32 @delete_shm_files(i16 zeroext %0) {
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = zext i16 %0 to i32
%11 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %6, i32 256, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %7, i32 256, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%13 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %8, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%14 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%15 = call i32 @unlink(i8* %8)
%16 = call i32 @unlink(i8* %9)
%17 = or i32 %16, %15
ret i32 %17
}