#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 */
unsigned long compute_value(unsigned long);
int /*<<< orphan*/ printf(char *, int, unsigned long);
scalar_t__ time(int /*<<< orphan*/ *);
int fn1(void) {

#pragma ASPIRE begin protection(code_mobility, status(mobile))

  int x = 1, fn = x;
  unsigned long myvalue = (unsigned long)time(NULL);
  myvalue *= 2;
  myvalue = compute_value(myvalue);
  for (; x < 20; x++) {
    myvalue = myvalue - x;
  }
  printf("Ground Control to Major Tom (fn%d, v: %d)\n", fn, myvalue);
  return x;

#pragma ASPIRE end
  ;
}


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <compute_value@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x14,-0x4(%rbp)
jge    1192 <fn1+0x62>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116b <fn1+0x3b>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn1>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
lea    (%rax,%rax,1),%rdi
call   1050 <compute_value@plt>
lea    -0xbe(%rax),%rdx
lea    0xeb1(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0x14,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Ground Control to Major Tom (fn%d, v: %d)\0A\00"
define i32 @fn1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 1, i32* %1
%4 = load i32, i32* %1
store i32 %4, i32* %2
%5 = call i64 @time(i32* null)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = mul i64 %6, 2
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = call i64 @compute_value(i64 %8)
store i64 %9, i64* %3
br label %10
10: ; preds = %18, %0
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 20
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i64, i64* %3
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = sub i64 %14, %16
store i64 %17, i64* %3
br label %18
18: ; preds = %13
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %10
21: ; preds = %10
%22 = load i32, i32* %2
%23 = load i64, i64* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %22, i64 %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [43 x i8] c"Ground Control to Major Tom (fn%d, v: %d)\0A\00"
define i32 @fn1() {
%1 = tail call i64 @time(i32* null)
%2 = shl i64 %1, 1
%3 = tail call i64 @compute_value(i64 %2)
%4 = add i64 %3, -190
%5 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 1, i64 %4)
ret i32 20
}