#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 int64_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ mill_msleep(int, char *);
int now();
int main() {
  int64_t deadline = now() + 100;
  mill_msleep(
      (deadline),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/8l/libmill/refs/heads/master/tests/sleep.c"
      ":"
      "34");
  int64_t diff = now() - deadline;
  assert(diff > -10 && diff < 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <now@plt>
add    $0x64,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xeaa(%rip),%rsi
call   1040 <mill_msleep@plt>
mov    $0x0,%al
call   1050 <now@plt>
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xfffffff6,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jle    1181 <main+0x51>
cmpl   $0xa,-0xc(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <now@plt>
mov    %eax,%ebx
lea    0x64(%rbx),%edi
lea    0xebc(%rip),%rsi
call   1040 <mill_msleep@plt>
xor    %eax,%eax
call   1050 <now@plt>
sub    %ebx,%eax
add    $0xffffffa5,%eax
xor    %edi,%edi
cmp    $0x13,%eax
setb   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/libmill/refs/heads/master/tests/sleep.c:34\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @now()
%5 = add nsw i32 %4, 100
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @mill_msleep(i32 %6, i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @now()
%9 = load i32, i32* %2
%10 = sub nsw i32 %8, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, -10
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 10
br label %16
16: ; preds = %13, %0
%17 = phi i1 [ false, %0 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/libmill/refs/heads/master/tests/sleep.c:34\00"
define i32 @main() {
%1 = tail call i32 (...) @now()
%2 = add nsw i32 %1, 100
%3 = tail call i32 @mill_msleep(i32 %2, i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @now()
%5 = sub i32 -91, %1
%6 = add i32 %5, %4
%7 = icmp ult i32 %6, 19
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
ret i32 0
}