#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 putb(int /*<<< orphan*/);
int flushbs(void) {
  for (int i = 0; i < 7; ++i) {
    if (putb(0) == -1) {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<flushbs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1158 <flushbs+0x48>
xor    %edi,%edi
call   1030 <putb@plt>
cmp    $0xffffffff,%eax
jne    1145 <flushbs+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <flushbs+0x4f>
jmp    114a <flushbs+0x3a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <flushbs+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flushbs>:
push   %rbx
xor    %edi,%edi
call   1030 <putb@plt>
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%eax
je     116f <flushbs+0x5f>
xor    %edi,%edi
call   1030 <putb@plt>
cmp    $0xffffffff,%eax
je     116f <flushbs+0x5f>
xor    %edi,%edi
call   1030 <putb@plt>
cmp    $0xffffffff,%eax
je     116f <flushbs+0x5f>
xor    %edi,%edi
call   1030 <putb@plt>
cmp    $0xffffffff,%eax
je     116f <flushbs+0x5f>
xor    %edi,%edi
call   1030 <putb@plt>
cmp    $0xffffffff,%eax
je     116f <flushbs+0x5f>
xor    %edi,%edi
call   1030 <putb@plt>
cmp    $0xffffffff,%eax
je     116f <flushbs+0x5f>
xor    %edi,%edi
call   1030 <putb@plt>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
sete   %bl
neg    %ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @flushbs() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 7
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = call i32 @putb(i32 0)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 -1, i32* %1
br label %15
10: ; preds = %6
br label %11
11: ; preds = %10
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
store i32 0, i32* %1
br label %15
15: ; preds = %14, %9
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @flushbs() {
%1 = tail call i32 @putb(i32 0)
%2 = icmp eq i32 %1, -1
br i1 %2, label %22, label %3
3: ; preds = %0
%4 = tail call i32 @putb(i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %22, label %6
6: ; preds = %3
%7 = tail call i32 @putb(i32 0)
%8 = icmp eq i32 %7, -1
br i1 %8, label %22, label %9
9: ; preds = %6
%10 = tail call i32 @putb(i32 0)
%11 = icmp eq i32 %10, -1
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = tail call i32 @putb(i32 0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = tail call i32 @putb(i32 0)
%17 = icmp eq i32 %16, -1
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = tail call i32 @putb(i32 0)
%20 = icmp eq i32 %19, -1
%21 = sext i1 %20 to i32
br label %22
22: ; preds = %18, %15, %12, %9, %6, %3, %0
%23 = phi i32 [ -1, %0 ], [ -1, %3 ], [ -1, %6 ], [ -1, %9 ], [ -1, %12 ], [ -1, %15 ], [ %21, %18 ]
ret i32 %23
}