#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*/ send_block(int, double, int);
int send_blocks(int num_blocks, int block_size, double e, int max_errors) {
  int blocks_success = 1;
  for (int block = 0; block < num_blocks; block++) {
    if (!send_block(block_size, e, max_errors))
      blocks_success = 0;
  }
  return blocks_success;
}


x86 assembly (clang, -O0):
<send_blocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1173 <send_blocks+0x63>
mov    -0x8(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%esi
call   1030 <send_block@plt>
cmp    $0x0,%eax
jne    1160 <send_blocks+0x50>
movl   $0x0,-0x18(%rbp)
jmp    1165 <send_blocks+0x55>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <send_blocks+0x24>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_blocks>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    114c <send_blocks+0x3c>
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebp
mov    $0x1,%ebx
movsd  %xmm0,(%rsp)
nopl   (%rax)
mov    %r15d,%edi
movsd  (%rsp),%xmm0
mov    %r14d,%esi
call   1030 <send_block@plt>
test   %eax,%eax
cmove  %eax,%ebx
add    $0xffffffff,%ebp
jne    1130 <send_blocks+0x20>
jmp    1151 <send_blocks+0x41>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @send_blocks(i32 %0, i32 %1, double %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
store i32 %3, i32* %8
store i32 1, i32* %9
store i32 0, i32* %10
br label %11
11: ; preds = %23, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i32, i32* %6
%17 = load double, double* %7
%18 = load i32, i32* %8
%19 = call i32 @send_block(i32 %16, double %17, i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %15
store i32 0, i32* %9
br label %22
22: ; preds = %21, %15
br label %23
23: ; preds = %22
%24 = load i32, i32* %10
%25 = add nsw i32 %24, 1
store i32 %25, i32* %10
br label %11
26: ; preds = %11
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
define i32 @send_blocks(i32 %0, i32 %1, double %2, i32 %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %8, label %6
6: ; preds = %8, %4
%7 = phi i32 [ 1, %4 ], [ %13, %8 ]
ret i32 %7
8: ; preds = %4, %8
%9 = phi i32 [ %14, %8 ], [ 0, %4 ]
%10 = phi i32 [ %13, %8 ], [ 1, %4 ]
%11 = tail call i32 @send_block(i32 %1, double %2, i32 %3)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 0, i32 %10
%14 = add nuw nsw i32 %9, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %6, label %8
}