#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*/ showtext();
double sqrt(double);
int /*<<< orphan*/ tnoua(char *);
void sleep(int i) {
  int j;
  long k;
  double pi, root;
  pi = 22 / 7;
  for (j = 0; j < i; j++) {
    for (k = 0; k < 1000; k++)
      root = sqrt(pi);
    tnoua(".");
    showtext();
  }
  root = root--;
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b2 <sleep+0x82>
movq   $0x0,-0x10(%rbp)
cmpq   $0x3e8,-0x10(%rbp)
jge    1191 <sleep+0x61>
movsd  -0x18(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1163 <sleep+0x33>
lea    0xe78(%rip),%rdi
call   1050 <tnoua@plt>
mov    $0x0,%al
call   1040 <showtext@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <sleep+0x1f>
movsd  -0x20(%rbp),%xmm0
movsd  0xe49(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm0,-0x20(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1154 <sleep+0x34>
mov    %edi,%ebx
lea    0xecf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <tnoua@plt>
xor    %eax,%eax
call   1030 <showtext@plt>
add    $0xffffffff,%ebx
jne    1140 <sleep+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define void @sleep(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %2
store double 3.000000e+00, double* %5
store i32 0, i32* %3
br label %7
7: ; preds = %24, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
store i64 0, i64* %4
br label %12
12: ; preds = %18, %11
%13 = load i64, i64* %4
%14 = icmp slt i64 %13, 1000
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load double, double* %5
%17 = call double @sqrt(double %16)
store double %17, double* %6
br label %18
18: ; preds = %15
%19 = load i64, i64* %4
%20 = add nsw i64 %19, 1
store i64 %20, i64* %4
br label %12
21: ; preds = %12
%22 = call i32 @tnoua(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = call i32 (...) @showtext()
br label %24
24: ; preds = %21
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %7
27: ; preds = %7
%28 = load double, double* %6
%29 = fadd double %28, -1.000000e+00
store double %29, double* %6
store double %28, double* %6
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define void @sleep(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = tail call i32 @tnoua(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @showtext()
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %3
9: ; preds = %3, %1
ret void
}