#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(double *);
int getpid();
double *malloc(int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, const char **argv) {
  int stop = 5, a = 0;
  double c = 60.;
  double *d = malloc(sizeof(double));
  *d = 5.;
  fprintf(stderr, "(%d) need a=%d to stop!\n", getpid(), stop);
  fprintf(stderr, "&stop = %p, &a = %p, &c = %p\n", &stop, &a, &c);
  fprintf(stderr, "stop = %d, a = %d, c = %g\n", stop, a, c);
  fprintf(stderr, "&d = %p, d = %p, *d = %g\n", &d, d, *d);
  while (a != stop)
    sleep(1);
  fprintf(stderr, "%g, %d, %d\n", *d, a, stop);
  free(d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  0xe65(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%r8
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
lea    0xe41(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rcx
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe39(%rip),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     124f <main+0xff>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1234 <main+0xe4>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe0f(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movl   $0x5,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movabs $0x404e000000000000,%rax
mov    %rax,0x18(%rsp)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x10(%rsp)
movabs $0x4014000000000000,%rax
mov    %rax,(%rbx)
mov    0x2e43(%rip),%r14
mov    (%r14),%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe52(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
mov    $0x5,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r14),%edi
lea    0xe51(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r14),%edi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
movsd  0x18(%rsp),%xmm0
lea    0xe41(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    (%r14),%edi
movsd  (%rbx),%xmm0
lea    0xe47(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rcx
mov    $0x1,%al
call   1050 <fprintf@plt>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%ecx
cmp    0xc(%rsp),%ecx
je     1236 <main+0xe6>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1220 <main+0xd0>
mov    (%r14),%edi
mov    0x10(%rsp),%rax
movsd  (%rax),%xmm0
lea    0xe23(%rip),%rsi
mov    %ecx,%edx
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"(%d) need a=%d to stop!\0A\00"
@.str.1 = [30 x i8] c"&stop = %p, &a = %p, &c = %p\0A\00"
@.str.2 = [27 x i8] c"stop = %d, a = %d, c = %g\0A\00"
@.str.3 = [26 x i8] c"&d = %p, d = %p, *d = %g\0A\00"
@.str.4 = [12 x i8] c"%g, %d, %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
store i32 0, i32* %7
store double 6.000000e+01, double* %8
%10 = call double* @malloc(i32 8)
store double* %10, double** %9
%11 = load double*, double** %9
store double 5.000000e+00, double* %11
%12 = load i32, i32* @stderr
%13 = call i32 (...) @getpid()
%14 = load i32, i32* %6
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7, double* %8)
%18 = load i32, i32* @stderr
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load double, double* %8
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %20, double %21)
%23 = load i32, i32* @stderr
%24 = load double*, double** %9
%25 = load double*, double** %9
%26 = load double, double* %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double** %9, double* %24, double %26)
br label %28
28: ; preds = %32, %2
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = icmp ne i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @sleep(i32 1)
br label %28
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = load double*, double** %9
%37 = load double, double* %36
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %37, i32 %38, i32 %39)
%41 = load double*, double** %9
%42 = call i32 @free(double* %41)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"(%d) need a=%d to stop!\0A\00"
@.str.1 = [30 x i8] c"&stop = %p, &a = %p, &c = %p\0A\00"
@.str.2 = [27 x i8] c"stop = %d, a = %d, c = %g\0A\00"
@.str.3 = [26 x i8] c"&d = %p, d = %p, *d = %g\0A\00"
@.str.4 = [12 x i8] c"%g, %d, %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double*
%7 = bitcast i32* %3 to i8*
store i32 5, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast double* %5 to i8*
store double 6.000000e+01, double* %5
%10 = bitcast double** %6 to i8*
%11 = tail call double* @malloc(i32 8)
store double* %11, double** %6
store double 5.000000e+00, double* %11
%12 = load i32, i32* @stderr
%13 = tail call i32 (...) @getpid()
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %13, i32 5)
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4, double* %5)
%17 = load i32, i32* @stderr
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = load double, double* %5
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %19, double %20)
%22 = load i32, i32* @stderr
%23 = load double, double* %11
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double** %6, double* %11, double %23)
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = icmp eq i32 %25, %26
br i1 %27, label %33, label %28
28: ; preds = %2, %28
%29 = call i32 @sleep(i32 1)
%30 = load i32, i32* %4
%31 = load i32, i32* %3
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %28
33: ; preds = %28, %2
%34 = phi i32 [ %25, %2 ], [ %30, %28 ]
%35 = load i32, i32* @stderr
%36 = load double*, double** %6
%37 = load double, double* %36
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %37, i32 %34, i32 %34)
%39 = load double*, double** %6
%40 = call i32 @free(double* %39)
ret i32 0
}