#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 minutes();
int seconds();
void sleep(int secs) {
  int secs_to_sleep = seconds(), minut = minutes(), segundos;
  secs_to_sleep += secs;
  if (secs_to_sleep > 60)
    minut += secs_to_sleep / 60;
  segundos = secs_to_sleep % 60;
  while (minutes() < minut) {
  };
  while (seconds() < segundos) {
  };
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <seconds@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <minutes@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x3c,-0x8(%rbp)
jle    1163 <sleep+0x43>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <minutes@plt>
cmp    -0xc(%rbp),%eax
jge    1186 <sleep+0x66>
jmp    1171 <sleep+0x51>
jmp    118b <sleep+0x6b>
mov    $0x0,%al
call   1030 <seconds@plt>
cmp    -0x10(%rbp),%eax
jge    11a0 <sleep+0x80>
jmp    118b <sleep+0x6b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %eax,%eax
call   1030 <seconds@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <minutes@plt>
mov    %eax,%ebp
add    %r14d,%ebx
cmp    $0x3d,%ebx
jl     1160 <sleep+0x40>
mov    %ebx,%eax
mov    $0x88888889,%ecx
imul   %rax,%rcx
shr    $0x25,%rcx
add    %ebp,%ecx
mov    %ecx,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <minutes@plt>
cmp    %ebp,%eax
jl     1160 <sleep+0x40>
movslq %ebx,%rax
imul   $0xffffffff88888889,%rax,%rax
shr    $0x20,%rax
add    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <seconds@plt>
cmp    %ebx,%eax
jl     1190 <sleep+0x70>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @sleep(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = call i32 (...) @seconds()
store i32 %6, i32* %3
%7 = call i32 (...) @minutes()
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 60
br i1 %12, label %13, label %18
13: ; preds = %1
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 60
%16 = load i32, i32* %4
%17 = add nsw i32 %16, %15
store i32 %17, i32* %4
br label %18
18: ; preds = %13, %1
%19 = load i32, i32* %3
%20 = srem i32 %19, 60
store i32 %20, i32* %5
br label %21
21: ; preds = %25, %18
%22 = call i32 (...) @minutes()
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %21
br label %21
26: ; preds = %21
br label %27
27: ; preds = %31, %26
%28 = call i32 (...) @seconds()
%29 = load i32, i32* %5
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %27
br label %27
32: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @sleep(i32 %0) {
%2 = tail call i32 (...) @seconds()
%3 = tail call i32 (...) @minutes()
%4 = add nsw i32 %2, %0
%5 = icmp sgt i32 %4, 60
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = udiv i32 %4, 60
%8 = add nsw i32 %7, %3
br label %9
9: ; preds = %6, %1
%10 = phi i32 [ %8, %6 ], [ %3, %1 ]
br label %11
11: ; preds = %11, %9
%12 = tail call i32 (...) @minutes()
%13 = icmp slt i32 %12, %10
br i1 %13, label %11, label %14
14: ; preds = %11
%15 = srem i32 %4, 60
br label %16
16: ; preds = %14, %16
%17 = tail call i32 (...) @seconds()
%18 = icmp slt i32 %17, %15
br i1 %18, label %16, label %19
19: ; preds = %16
ret void
}