#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*/ memcpy(unsigned long long *, unsigned long long *,
                          unsigned long long);
void remove_transient_samples(long long unsigned **samples,
                              long long unsigned *total_number,
                              const int cpus) {
  int i;
  long long unsigned invalid;
  for (i = 0; i < cpus; i++) {
    invalid = (long long unsigned)(total_number[i] * 0.1);
    memcpy(&samples[i][0], &samples[i][invalid],
           (total_number[i] - invalid) * sizeof(**samples));
    total_number[i] -= invalid;
  }
}


x86 assembly (clang, -O0):
<remove_transient_samples>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fc <remove_transient_samples+0xec>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movq   (%rax,%rcx,8),%xmm0
movaps 0xeb6(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xeba(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xea0(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
sub    -0x20(%rbp),%rdx
shl    $0x3,%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
sub    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <remove_transient_samples+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_transient_samples>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    119d <remove_transient_samples+0x8d>
mov    %rsi,%r12
mov    %rdi,%r14
mov    %edx,%r15d
xor    %r13d,%r13d
nopl   (%rax)
mov    (%r12,%r13,8),%rdx
movq   %rdx,%xmm0
punpckldq 0xebf(%rip),%xmm0
subpd  0xec7(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xec3(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xeb7(%rip),%xmm1
cvttsd2si %xmm1,%rbx
and    %rcx,%rbx
or     %rax,%rbx
mov    (%r14,%r13,8),%rdi
lea    (%rdi,%rbx,8),%rsi
sub    %rbx,%rdx
shl    $0x3,%rdx
call   1030 <memcpy@plt>
sub    %rbx,(%r12,%r13,8)
add    $0x1,%r13
cmp    %r13,%r15
jne    1130 <remove_transient_samples+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @remove_transient_samples(i64** %0, i64* %1, i32 %2) {
%4 = alloca i64**
%5 = alloca i64*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i64** %0, i64*** %4
store i64* %1, i64** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %51, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %54
13: ; preds = %9
%14 = load i64*, i64** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i64, i64* %14, i64 %16
%18 = load i64, i64* %17
%19 = uitofp i64 %18 to double
%20 = fmul double %19, 1.000000e-01
%21 = fptoui double %20 to i64
store i64 %21, i64* %8
%22 = load i64**, i64*** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64*, i64** %22, i64 %24
%26 = load i64*, i64** %25
%27 = getelementptr inbounds i64, i64* %26, i64 0
%28 = load i64**, i64*** %4
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i64*, i64** %28, i64 %30
%32 = load i64*, i64** %31
%33 = load i64, i64* %8
%34 = getelementptr inbounds i64, i64* %32, i64 %33
%35 = load i64*, i64** %5
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i64, i64* %35, i64 %37
%39 = load i64, i64* %38
%40 = load i64, i64* %8
%41 = sub i64 %39, %40
%42 = mul i64 %41, 8
%43 = call i32 @memcpy(i64* %27, i64* %34, i64 %42)
%44 = load i64, i64* %8
%45 = load i64*, i64** %5
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i64, i64* %45, i64 %47
%49 = load i64, i64* %48
%50 = sub i64 %49, %44
store i64 %50, i64* %48
br label %51
51: ; preds = %13
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %9
54: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @remove_transient_samples(i64** nocapture %0, i64* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %24
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %22, %7 ]
%9 = getelementptr inbounds i64, i64* %1, i64 %8
%10 = load i64, i64* %9
%11 = uitofp i64 %10 to double
%12 = fmul double %11, 1.000000e-01
%13 = fptoui double %12 to i64
%14 = getelementptr inbounds i64*, i64** %0, i64 %8
%15 = load i64*, i64** %14
%16 = getelementptr inbounds i64, i64* %15, i64 %13
%17 = sub i64 %10, %13
%18 = shl i64 %17, 3
%19 = tail call i32 @memcpy(i64* %15, i64* %16, i64 %18)
%20 = load i64, i64* %9
%21 = sub i64 %20, %13
store i64 %21, i64* %9
%22 = add nuw nsw i64 %8, 1
%23 = icmp eq i64 %22, %6
br i1 %23, label %24, label %7
24: ; preds = %7, %3
ret void
}