#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*/ sleep(int);
scalar_t__ system(char *);
bool wait_for_macvlan(void) {
  int i;
  for (i = 0; i < 10; i++) {
    if (system("ip addr list dev "
               "zdtmmvlan0") == 0)
      return true;
    sleep(1);
  }
  return false;
}


x86 assembly (clang, -O0):
<wait_for_macvlan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1173 <wait_for_macvlan+0x53>
lea    0xec0(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
jne    115b <wait_for_macvlan+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    117a <wait_for_macvlan+0x5a>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <wait_for_macvlan+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_macvlan>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <system@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xeb4(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xe90(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xe6c(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xe48(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xe24(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xe00(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xde0(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xdc0(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xda0(%rip),%rdi
call   1030 <system@plt>
test   %rax,%rax
je     1276 <wait_for_macvlan+0x156>
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"ip addr list dev zdtmmvlan0\00"
define i32 @wait_for_macvlan() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %1
br label %16
10: ; preds = %6
%11 = call i32 @sleep(i32 1)
br label %12
12: ; preds = %10
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %3
15: ; preds = %3
store i32 0, i32* %1
br label %16
16: ; preds = %15, %9
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [28 x i8] c"ip addr list dev zdtmmvlan0\00"
define i32 @wait_for_macvlan() {
%1 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %41, label %3
3: ; preds = %0
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %41, label %7
7: ; preds = %3
%8 = tail call i32 @sleep(i32 1)
%9 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %41, label %11
11: ; preds = %7
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %41, label %15
15: ; preds = %11
%16 = tail call i32 @sleep(i32 1)
%17 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %41, label %19
19: ; preds = %15
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %41, label %23
23: ; preds = %19
%24 = tail call i32 @sleep(i32 1)
%25 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %41, label %27
27: ; preds = %23
%28 = tail call i32 @sleep(i32 1)
%29 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %41, label %31
31: ; preds = %27
%32 = tail call i32 @sleep(i32 1)
%33 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %31
%36 = tail call i32 @sleep(i32 1)
%37 = tail call i64 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %35
%40 = tail call i32 @sleep(i32 1)
br label %41
41: ; preds = %39, %35, %31, %27, %23, %19, %15, %11, %7, %3, %0
%42 = phi i32 [ 1, %0 ], [ 1, %3 ], [ 1, %7 ], [ 1, %11 ], [ 1, %15 ], [ 1, %19 ], [ 1, %23 ], [ 1, %27 ], [ 1, %31 ], [ 1, %35 ], [ 0, %39 ]
ret i32 %42
}