#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*/ usleep(int /*<<< orphan*/);
void load_cpu(void) {
  unsigned long count = 0;
  unsigned long i;
  const unsigned int log2_iter = 10;
  for (i = 0; i < (1 << log2_iter); i++) {
    if ((i & 0x111) == i)
      i++;
    if (i > i % 19)
      usleep(0);
  }
}


x86 assembly (clang, -O0):
<load_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movl   $0xa,-0x14(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x400,-0x10(%rbp)
jae    119d <load_cpu+0x8d>
mov    -0x10(%rbp),%rax
and    $0x111,%rax
cmp    -0x10(%rbp),%rax
jne    115d <load_cpu+0x4d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x13,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x20(%rbp),%rax
cmp    %rdx,%rax
jbe    1187 <load_cpu+0x77>
xor    %edi,%edi
call   1030 <usleep@plt>
jmp    118c <load_cpu+0x7c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <load_cpu+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_cpu>:
push   %rbx
xor    %ebx,%ebx
jmp    1130 <load_cpu+0x20>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rbx),%rax
cmp    $0x3ff,%rbx
mov    %rax,%rbx
jae    1168 <load_cpu+0x58>
mov    %rbx,%rax
and    $0xfffffffffffffeee,%rax
cmp    $0x1,%rax
adc    $0x0,%rbx
movzwl %bx,%eax
imul   $0xd795,%eax,%eax
shr    $0x14,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,2),%eax
mov    %ebx,%ecx
sub    %eax,%ecx
movzwl %cx,%eax
cmp    %rax,%rbx
jbe    1120 <load_cpu+0x10>
xor    %edi,%edi
call   1030 <usleep@plt>
jmp    1120 <load_cpu+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @load_cpu() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i32
store i64 0, i64* %1
store i32 10, i32* %3
store i64 0, i64* %2
br label %4
4: ; preds = %23, %0
%5 = load i64, i64* %2
%6 = icmp ult i64 %5, 1024
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = load i64, i64* %2
%9 = and i64 %8, 273
%10 = load i64, i64* %2
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i64, i64* %2
%14 = add i64 %13, 1
store i64 %14, i64* %2
br label %15
15: ; preds = %12, %7
%16 = load i64, i64* %2
%17 = load i64, i64* %2
%18 = urem i64 %17, 19
%19 = icmp ugt i64 %16, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @usleep(i32 0)
br label %22
22: ; preds = %20, %15
br label %23
23: ; preds = %22
%24 = load i64, i64* %2
%25 = add i64 %24, 1
store i64 %25, i64* %2
br label %4
26: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @load_cpu() {
br label %1
1: ; preds = %0, %13
%2 = phi i64 [ 0, %0 ], [ %14, %13 ]
%3 = and i64 %2, 273
%4 = icmp eq i64 %3, %2
%5 = zext i1 %4 to i64
%6 = add nuw nsw i64 %2, %5
%7 = trunc i64 %6 to i16
%8 = urem i16 %7, 19
%9 = zext i16 %8 to i64
%10 = icmp ugt i64 %6, %9
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = tail call i32 @usleep(i32 0)
br label %13
13: ; preds = %1, %11
%14 = add nuw nsw i64 %6, 1
%15 = icmp ult i64 %6, 1023
br i1 %15, label %1, label %16
16: ; preds = %13
ret void
}