#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*/ receiveMessages();
int /*<<< orphan*/ sendMessage(char *, int, char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  receiveMessages();
  int i = 10;
  while (i > 0) {
    sendMessage("world", -1, "world !!!");
    sleep(1);
    i--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <receiveMessages@plt>
movl   $0xa,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1187 <main+0x57>
lea    0xea2(%rip),%rdi
mov    $0xffffffff,%esi
lea    0xe9c(%rip),%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <receiveMessages@plt>
lea    0xebe(%rip),%rbx
lea    0xebd(%rip),%r14
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %r14,%rdx
call   1030 <sendMessage@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"world\00"
@.str.1 = [10 x i8] c"world !!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @receiveMessages()
store i32 10, i32* %2
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @sleep(i32 1)
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
br label %4
12: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"world\00"
@.str.1 = [10 x i8] c"world !!!\00"
define i32 @main() {
%1 = tail call i32 (...) @receiveMessages()
%2 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @sleep(i32 1)
%12 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @sleep(i32 1)
%14 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @sleep(i32 1)
%16 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @sleep(i32 1)
%18 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @sleep(i32 1)
%20 = tail call i32 @sendMessage(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 @sleep(i32 1)
ret i32 0
}