#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 nc_nvr_set_broadcast(int);
int nc_nvr_set_wps_pbc();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int netcore_wps(int enable) {
  int ret;
  ret = nc_nvr_set_broadcast(enable);
  if (ret < 0) {
    printf("set broadcast failed!\n");
    return -1;
  }
  sleep(10);
  ret = nc_nvr_set_wps_pbc();
  if (ret < 0) {
    printf("set pbc failed!\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<netcore_wps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <nc_nvr_set_broadcast@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1178 <netcore_wps+0x38>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b5 <netcore_wps+0x75>
mov    $0xa,%edi
call   1060 <sleep@plt>
mov    $0x0,%al
call   1030 <nc_nvr_set_wps_pbc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11ae <netcore_wps+0x6e>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b5 <netcore_wps+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netcore_wps>:
push   %rbx
call   1050 <nc_nvr_set_broadcast@plt>
test   %eax,%eax
js     116a <netcore_wps+0x2a>
mov    $0xa,%edi
call   1060 <sleep@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <nc_nvr_set_wps_pbc@plt>
test   %eax,%eax
jns    117b <netcore_wps+0x3b>
lea    0xe98(%rip),%rdi
jmp    1171 <netcore_wps+0x31>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"set broadcast failed!\0A\00"
@.str.1 = [17 x i8] c"set pbc failed!\0A\00"
define i32 @netcore_wps(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @nc_nvr_set_broadcast(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %19
11: ; preds = %1
%12 = call i32 @sleep(i32 10)
%13 = call i32 (...) @nc_nvr_set_wps_pbc()
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %19
18: ; preds = %11
store i32 0, i32* %2
br label %19
19: ; preds = %18, %16, %9
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@str = [16 x i8] c"set pbc failed!\00"
@str.2 = [22 x i8] c"set broadcast failed!\00"
define i32 @netcore_wps(i32 %0) {
%2 = tail call i32 @nc_nvr_set_broadcast(i32 %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @sleep(i32 10)
%6 = tail call i32 (...) @nc_nvr_set_wps_pbc()
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4, %1
%9 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), %4 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
br label %11
11: ; preds = %8, %4
%12 = phi i32 [ 0, %4 ], [ -1, %8 ]
ret i32 %12
}