#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*/ printf(char *, int);
int sqr(int);
main() {
  double a[] = {1.0, 2.0};
  double *p = a;
  printf("sqr(3.0)=%lf\n", (sqr(3.0)));
  printf("sqr(3)=%lf\n", sqr(3));
  printf("sqr(3 + 3)=%lf\n", sqr(3 + 3));
  printf("!sqr(3)=%lf\n", !sqr(3));
  printf("sqr(*p++)=%lf\n", sqr(*p++));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x3,%edi
call   1040 <sqr@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <sqr@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <sqr@plt>
mov    %eax,%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <sqr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
cvttsd2si (%rax),%edi
call   1040 <sqr@plt>
mov    %eax,%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1040 <sqr@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <sqr@plt>
lea    0xed5(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <sqr@plt>
lea    0xeac(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <sqr@plt>
xor    %esi,%esi
test   %eax,%eax
sete   %sil
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sqr@plt>
lea    0xe93(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.a = [2 x double] [double 1.000000e+00, double 2.000000e+00]
@.str = [14 x i8] c"sqr(3.0)=%lf\0A\00"
@.str.1 = [12 x i8] c"sqr(3)=%lf\0A\00"
@.str.2 = [16 x i8] c"sqr(3 + 3)=%lf\0A\00"
@.str.3 = [13 x i8] c"!sqr(3)=%lf\0A\00"
@.str.4 = [15 x i8] c"sqr(*p++)=%lf\0A\00"
define i32 @main() {
%1 = alloca [2 x double]
%2 = alloca double*
%3 = bitcast [2 x double]* %1 to i8*
%4 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
store double* %4, double** %2
%5 = call i32 @sqr(i32 3)
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @sqr(i32 3)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @sqr(i32 6)
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 @sqr(i32 3)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load double*, double** %2
%17 = getelementptr inbounds double, double* %16, i32 1
store double* %17, double** %2
%18 = load double, double* %16
%19 = fptosi double %18 to i32
%20 = call i32 @sqr(i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"sqr(3.0)=%lf\0A\00"
@.str.1 = [12 x i8] c"sqr(3)=%lf\0A\00"
@.str.2 = [16 x i8] c"sqr(3 + 3)=%lf\0A\00"
@.str.3 = [13 x i8] c"!sqr(3)=%lf\0A\00"
@.str.4 = [15 x i8] c"sqr(*p++)=%lf\0A\00"
define i32 @main() {
%1 = tail call i32 @sqr(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @sqr(i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @sqr(i32 6)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @sqr(i32 3)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @sqr(i32 1)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %11)
ret i32 0
}