#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*/ printf(char *, ...);
void print_all(int cpus, long long unsigned *total_number,
               long long unsigned **samples, long long unsigned *success_ops,
               long long unsigned *fail_ops) {
  int i, j;
  printf("cpus: %d\n\n", cpus);
  for (i = 0; i < cpus; i++) {
    printf("[%d]:\ttotal number: %llu\n", i, total_number[i]);
    for (j = 0; j < total_number[i]; j++)
      printf("[%d]:\t%llu\n", i, samples[i][j]);
    printf("[%d]:\tsuccess ops: %llu\n", i, success_ops[i]);
    printf("[%d]:\tfail ops: %llu\n", i, fail_ops[i]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1212 <print_all+0x102>
mov    -0x2c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
movslq -0x30(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
jae    11bc <print_all+0xac>
mov    -0x2c(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1173 <print_all+0x63>
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1143 <print_all+0x33>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_all>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb9(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    1204 <print_all+0xe4>
mov    %ebp,%r14d
lea    0xec3(%rip),%rbp
xor    %r13d,%r13d
jmp    11b7 <print_all+0x97>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
mov    (%rax,%r13,8),%rdx
lea    0xeb1(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rax
mov    (%rax,%r13,8),%rdx
lea    0xeb0(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r14,%r13
je     1204 <print_all+0xe4>
mov    (%rbx,%r13,8),%rdx
lea    0xe49(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x0,(%rbx,%r13,8)
je     1170 <print_all+0x50>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%r13,8),%rax
mov    (%rax,%r15,8),%rdx
mov    %rbp,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,(%rbx,%r13,8)
ja     11e0 <print_all+0xc0>
jmp    1170 <print_all+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"cpus: %d\0A\0A\00"
@.str.1 = [26 x i8] c"[%d]:\09total number: %llu\0A\00"
@.str.2 = [12 x i8] c"[%d]:\09%llu\0A\00"
@.str.3 = [25 x i8] c"[%d]:\09success ops: %llu\0A\00"
@.str.4 = [22 x i8] c"[%d]:\09fail ops: %llu\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @print_all(i32 %0, i64* %1, i64** %2, i64* %3, i64* %4) {
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i64**
%9 = alloca i64*
%10 = alloca i64*
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %6
store i64* %1, i64** %7
store i64** %2, i64*** %8
store i64* %3, i64** %9
store i64* %4, i64** %10
%13 = load i32, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 0, i32* %11
br label %15
15: ; preds = %67, %5
%16 = load i32, i32* %11
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %70
19: ; preds = %15
%20 = load i32, i32* %11
%21 = load i64*, i64** %7
%22 = load i32, i32* %11
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i64, i64* %21, i64 %23
%25 = load i64, i64* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %20, i64 %25)
store i32 0, i32* %12
br label %27
27: ; preds = %48, %19
%28 = load i32, i32* %12
%29 = sext i32 %28 to i64
%30 = load i64*, i64** %7
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i64, i64* %30, i64 %32
%34 = load i64, i64* %33
%35 = icmp ult i64 %29, %34
br i1 %35, label %36, label %51
36: ; preds = %27
%37 = load i32, i32* %11
%38 = load i64**, i64*** %8
%39 = load i32, i32* %11
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i64*, i64** %38, i64 %40
%42 = load i64*, i64** %41
%43 = load i32, i32* %12
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i64, i64* %42, i64 %44
%46 = load i64, i64* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %37, i64 %46)
br label %48
48: ; preds = %36
%49 = load i32, i32* %12
%50 = add nsw i32 %49, 1
store i32 %50, i32* %12
br label %27
51: ; preds = %27
%52 = load i32, i32* %11
%53 = load i64*, i64** %9
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i64, i64* %53, i64 %55
%57 = load i64, i64* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %52, i64 %57)
%59 = load i32, i32* %11
%60 = load i64*, i64** %10
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i64, i64* %60, i64 %62
%64 = load i64, i64* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %59, i64 %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %67
67: ; preds = %51
%68 = load i32, i32* %11
%69 = add nsw i32 %68, 1
store i32 %69, i32* %11
br label %15
70: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"cpus: %d\0A\0A\00"
@.str.1 = [26 x i8] c"[%d]:\09total number: %llu\0A\00"
@.str.2 = [12 x i8] c"[%d]:\09%llu\0A\00"
@.str.3 = [25 x i8] c"[%d]:\09success ops: %llu\0A\00"
@.str.4 = [22 x i8] c"[%d]:\09fail ops: %llu\0A\00"
define void @print_all(i32 %0, i64* nocapture %1, i64** nocapture %2, i64* nocapture %3, i64* nocapture %4) {
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %39
8: ; preds = %5
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %29
%11 = phi i64 [ 0, %8 ], [ %37, %29 ]
%12 = getelementptr inbounds i64, i64* %1, i64 %11
%13 = load i64, i64* %12
%14 = trunc i64 %11 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14, i64 %13)
%16 = load i64, i64* %12
%17 = icmp eq i64 %16, 0
br i1 %17, label %29, label %18
18: ; preds = %10
%19 = getelementptr inbounds i64*, i64** %2, i64 %11
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %26, %20 ]
%22 = load i64*, i64** %19
%23 = getelementptr inbounds i64, i64* %22, i64 %21
%24 = load i64, i64* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %14, i64 %24)
%26 = add nuw i64 %21, 1
%27 = load i64, i64* %12
%28 = icmp ugt i64 %27, %26
br i1 %28, label %20, label %29
29: ; preds = %20, %10
%30 = getelementptr inbounds i64, i64* %3, i64 %11
%31 = load i64, i64* %30
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %14, i64 %31)
%33 = getelementptr inbounds i64, i64* %4, i64 %11
%34 = load i64, i64* %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %14, i64 %34)
%36 = tail call i32 @putchar(i32 10)
%37 = add nuw nsw i64 %11, 1
%38 = icmp eq i64 %37, %9
br i1 %38, label %39, label %10
39: ; preds = %29, %5
ret void
}