#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*/ put_socket(unsigned int);
void application_put_data(unsigned packet[], unsigned start, unsigned length) {
  unsigned i, index;
  index = start;
  put_socket(length);
  for (i = 0; i < length; i += 2) {
    put_socket(packet[index]);
    index++;
  }
}


x86 assembly (clang, -O0):
<application_put_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <put_socket@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1169 <application_put_data+0x59>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
call   1030 <put_socket@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <application_put_data+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<application_put_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
mov    %edx,%edi
call   1030 <put_socket@plt>
test   %r15d,%r15d
je     1146 <application_put_data+0x36>
xor    %ebx,%ebx
nopl   (%rax)
mov    %ebp,%eax
mov    (%r14,%rax,4),%edi
call   1030 <put_socket@plt>
add    $0x1,%ebp
add    $0x2,%ebx
cmp    %r15d,%ebx
jb     1130 <application_put_data+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @application_put_data(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
%9 = load i32, i32* %5
store i32 %9, i32* %8
%10 = load i32, i32* %6
%11 = call i32 @put_socket(i32 %10)
store i32 0, i32* %7
br label %12
12: ; preds = %25, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = icmp ult i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i32*, i32** %4
%18 = load i32, i32* %8
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = call i32 @put_socket(i32 %21)
%23 = load i32, i32* %8
%24 = add i32 %23, 1
store i32 %24, i32* %8
br label %25
25: ; preds = %16
%26 = load i32, i32* %7
%27 = add i32 %26, 2
store i32 %27, i32* %7
br label %12
28: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @application_put_data(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @put_socket(i32 %2)
%5 = icmp eq i32 %2, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %13, %6 ], [ %1, %3 ]
%8 = phi i32 [ %14, %6 ], [ 0, %3 ]
%9 = zext i32 %7 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 @put_socket(i32 %11)
%13 = add i32 %7, 1
%14 = add i32 %8, 2
%15 = icmp ult i32 %14, %2
br i1 %15, label %6, label %16
16: ; preds = %6, %3
ret void
}