#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*/ abort();
scalar_t__ sched_yield();
void *process(void *arg) {
  int i;
  for (i = 0; i < 10; i++) {
    if (sched_yield() != 0)
      abort();
  }
  return NULL;
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1168 <process+0x48>
mov    $0x0,%al
call   1040 <sched_yield@plt>
cmp    $0x0,%rax
je     1155 <process+0x35>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    115a <process+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <process+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rax
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
call   1040 <sched_yield@plt>
test   %rax,%rax
jne    119d <process+0x7d>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @process(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = call i64 (...) @sched_yield()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %7
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @process(i8* nocapture readnone %0) {
%2 = tail call i64 (...) @sched_yield()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %32
4: ; preds = %1
%5 = tail call i64 (...) @sched_yield()
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %32
7: ; preds = %4
%8 = tail call i64 (...) @sched_yield()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = tail call i64 (...) @sched_yield()
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = tail call i64 (...) @sched_yield()
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = tail call i64 (...) @sched_yield()
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %16
%20 = tail call i64 (...) @sched_yield()
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = tail call i64 (...) @sched_yield()
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = tail call i64 (...) @sched_yield()
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = tail call i64 (...) @sched_yield()
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %28
ret i8* null
32: ; preds = %28, %25, %22, %19, %16, %13, %10, %7, %4, %1
%33 = tail call i32 (...) @abort()
unreachable
}