#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 */
scalar_t__ waitinput_sock(int);
int waitinput_1sec() {
  int i;
  for (i = 0; i < 10; i++)
    if (waitinput_sock(100))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<waitinput_1sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    115c <waitinput_1sec+0x4c>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
cmp    $0x0,%rax
je     1149 <waitinput_1sec+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1163 <waitinput_1sec+0x53>
jmp    114e <waitinput_1sec+0x3e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <waitinput_1sec+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitinput_1sec>:
push   %rbx
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
test   %rax,%rax
jne    11b3 <waitinput_1sec+0xa3>
mov    $0x64,%edi
call   1030 <waitinput_sock@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @waitinput_1sec() {
%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, 10
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = call i64 @waitinput_sock(i32 100)
%8 = icmp ne i64 %7, 0
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 @waitinput_1sec() {
%1 = tail call i64 @waitinput_sock(i32 100)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %31
3: ; preds = %0
%4 = tail call i64 @waitinput_sock(i32 100)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %31
6: ; preds = %3
%7 = tail call i64 @waitinput_sock(i32 100)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %31
9: ; preds = %6
%10 = tail call i64 @waitinput_sock(i32 100)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = tail call i64 @waitinput_sock(i32 100)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = tail call i64 @waitinput_sock(i32 100)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = tail call i64 @waitinput_sock(i32 100)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = tail call i64 @waitinput_sock(i32 100)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = tail call i64 @waitinput_sock(i32 100)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = tail call i64 @waitinput_sock(i32 100)
%29 = icmp ne i64 %28, 0
%30 = zext i1 %29 to i32
br label %31
31: ; preds = %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%32 = phi i32 [ 1, %0 ], [ 1, %3 ], [ 1, %6 ], [ 1, %9 ], [ 1, %12 ], [ 1, %15 ], [ 1, %18 ], [ 1, %21 ], [ 1, %24 ], [ %30, %27 ]
ret i32 %32
}