#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 EXIT_SUCCESS;
int /*<<< orphan*/ copydata();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getdata();
int /*<<< orphan*/ releasesharedmemory();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ timedsort();
int main(int argc, char **argv) {
  getdata();
  copydata();
  fprintf(stderr, "Have copied data\n");
  timedsort();
  fprintf(stderr, "have finished sort\n");
  releasesharedmemory();
  sleep(1);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <getdata@plt>
mov    $0x0,%al
call   1050 <copydata@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <timedsort@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1060 <releasesharedmemory@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1070 <getdata@plt>
xor    %eax,%eax
call   1050 <copydata@plt>
mov    0x2e6a(%rip),%rbx
mov    (%rbx),%edi
lea    0xe81(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <timedsort@plt>
mov    (%rbx),%edi
lea    0xe7e(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1060 <releasesharedmemory@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Have copied data\0A\00"
@.str.1 = [20 x i8] c"have finished sort\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @getdata()
%7 = call i32 (...) @copydata()
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @timedsort()
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (...) @releasesharedmemory()
%14 = call i32 @sleep(i32 1)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Have copied data\0A\00"
@.str.1 = [20 x i8] c"have finished sort\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getdata()
%4 = tail call i32 (...) @copydata()
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @timedsort()
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (...) @releasesharedmemory()
%11 = tail call i32 @sleep(i32 1)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}