#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 *, int, int);
void printStatistics(int numrcv, int packetnum, int *stat) {
  int j = 0, i = 1;
  for (i = 1; i < numrcv; ++i) {
    if (!(*(stat + j) == i)) {
      j--;
    }
    ++j;
  }
  printf("Packets recived: %d\nPackets lost: %d\n", numrcv, packetnum - numrcv);
}


x86 assembly (clang, -O0):
<printStatistics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1177 <printStatistics+0x67>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
je     1160 <printStatistics+0x50>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1137 <printStatistics+0x27>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    -0x4(%rbp),%edx
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStatistics>:
mov    %esi,%edx
mov    %edi,%esi
sub    %edi,%edx
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Packets recived: %d\0APackets lost: %d\0A\00"
define void @printStatistics(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 0, i32* %7
store i32 1, i32* %8
store i32 1, i32* %8
br label %9
9: ; preds = %27, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %8
%20 = icmp eq i32 %18, %19
br i1 %20, label %24, label %21
21: ; preds = %13
%22 = load i32, i32* %7
%23 = add nsw i32 %22, -1
store i32 %23, i32* %7
br label %24
24: ; preds = %21, %13
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %27
27: ; preds = %24
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %9
30: ; preds = %9
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = sub nsw i32 %32, %33
%35 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %34)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Packets recived: %d\0APackets lost: %d\0A\00"
define void @printStatistics(i32 %0, i32 %1, i32* nocapture %2) {
%4 = sub nsw i32 %1, %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
ret void
}