#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 */
typedef int /*<<< orphan*/ cpuset;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ sched_setaffinity(int /*<<< orphan*/, int,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ test_task_rename(int);
int /*<<< orphan*/ test_urandom_read(int);
void loop(int cpu, int flags) {
  cpu_set_t cpuset;
  CPU_ZERO(&cpuset);
  CPU_SET(cpu, &cpuset);
  sched_setaffinity(0, sizeof(cpuset), &cpuset);
  if (flags & 1) {
    test_task_rename(cpu);
  }
  if (flags & 2) {
    test_urandom_read(cpu);
  }
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <CPU_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1060 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0xc(%rbp),%rdx
call   1030 <sched_setaffinity@plt>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     119a <loop+0x4a>
mov    -0x4(%rbp),%edi
call   1040 <test_task_rename@plt>
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11b1 <loop+0x61>
mov    -0x4(%rbp),%edi
call   1070 <test_urandom_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %edi,%r14d
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <CPU_ZERO@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1060 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1030 <sched_setaffinity@plt>
test   $0x1,%bpl
je     1192 <loop+0x42>
mov    %r14d,%edi
call   1040 <test_task_rename@plt>
test   $0x2,%bpl
je     11a0 <loop+0x50>
mov    %r14d,%edi
call   1070 <test_urandom_read@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @loop(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @CPU_ZERO(i32* %5)
%7 = load i32, i32* %3
%8 = call i32 @CPU_SET(i32 %7, i32* %5)
%9 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %5)
%10 = load i32, i32* %4
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* %3
%15 = call i32 @test_task_rename(i32 %14)
br label %16
16: ; preds = %13, %2
%17 = load i32, i32* %4
%18 = and i32 %17, 2
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %3
%22 = call i32 @test_urandom_read(i32 %21)
br label %23
23: ; preds = %20, %16
ret void
}

LLVM IR (-O2):
define void @loop(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @CPU_ZERO(i32* %3)
%6 = call i32 @CPU_SET(i32 %0, i32* %3)
%7 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %3)
%8 = and i32 %1, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @test_task_rename(i32 %0)
br label %12
12: ; preds = %10, %2
%13 = and i32 %1, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 @test_urandom_read(i32 %0)
br label %17
17: ; preds = %15, %12
ret void
}