#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*/ iclose(int);
scalar_t__ isocket_pair_imp(int *, int, int);
int isocket_try_firewall(void) {
  int i;
  for (i = 0; i < 2; i++) {
    int fds[2];
    if (isocket_pair_imp(fds, 1, 150) == 0) {
      iclose(fds[0]);
      iclose(fds[1]);
      return 0;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<isocket_try_firewall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1185 <isocket_try_firewall+0x65>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x96,%edx
call   1030 <isocket_pair_imp@plt>
cmp    $0x0,%rax
jne    1172 <isocket_try_firewall+0x52>
mov    -0x10(%rbp),%edi
call   1040 <iclose@plt>
mov    -0xc(%rbp),%edi
call   1040 <iclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    118c <isocket_try_firewall+0x6c>
jmp    1177 <isocket_try_firewall+0x57>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <isocket_try_firewall+0xf>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isocket_try_firewall>:
push   %rax
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x96,%edx
call   1030 <isocket_pair_imp@plt>
test   %rax,%rax
je     1156 <isocket_try_firewall+0x36>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x96,%edx
call   1030 <isocket_pair_imp@plt>
test   %rax,%rax
je     1156 <isocket_try_firewall+0x36>
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    (%rsp),%edi
call   1040 <iclose@plt>
mov    0x4(%rsp),%edi
call   1040 <iclose@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @isocket_try_firewall() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
store i32 0, i32* %2
br label %4
4: ; preds = %19, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 2
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%9 = call i64 @isocket_pair_imp(i32* %8, i32 1, i32 150)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%13 = load i32, i32* %12
%14 = call i32 @iclose(i32 %13)
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%16 = load i32, i32* %15
%17 = call i32 @iclose(i32 %16)
store i32 0, i32* %1
br label %23
18: ; preds = %7
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %4
22: ; preds = %4
store i32 -1, i32* %1
br label %23
23: ; preds = %22, %11
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
define i32 @isocket_try_firewall() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%4 = call i64 @isocket_pair_imp(i32* %3, i32 1, i32 150)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %12, %0
%7 = load i32, i32* %3
%8 = call i32 @iclose(i32 %7)
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%10 = load i32, i32* %9
%11 = call i32 @iclose(i32 %10)
br label %16
12: ; preds = %0
%13 = call i64 @isocket_pair_imp(i32* %3, i32 1, i32 150)
%14 = icmp eq i64 %13, 0
br i1 %14, label %6, label %15
15: ; preds = %12
br label %16
16: ; preds = %15, %6
%17 = phi i32 [ 0, %6 ], [ -1, %15 ]
ret i32 %17
}