#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 */
struct w {
  int a;
  char b;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double square(double);
  printf("%g\n", square(0.3));
  printf("%g\n", square(2));
  int add();
  printf("%d,%d\n", add(2), (int)2.1);
  int i;
  char c;
  for (i = 0; i < 2; i++) {
    printf("%d ", i);
  }
  printf("\n");
  union w {
    int a;
    char b;
  } cw;
  cw.a = 1;
  printf("%d", cw.b == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
call   1040 <square@plt>
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xe9e(%rip),%xmm0
call   1040 <square@plt>
lea    0xea2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe8a(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11c6 <main+0x96>
mov    -0x8(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119d <main+0x6d>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x10(%rbp)
movsbl -0x10(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xeb7(%rip),%xmm0
call   1050 <square@plt>
lea    0xebb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xea1(%rip),%xmm0
call   1050 <square@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x2,%edi
xor    %eax,%eax
call   1040 <add@plt>
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe7d(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe55(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%union.w = type { i32 }
@.str = [4 x i8] c"%g\0A\00"
@.str.1 = [7 x i8] c"%d,%d\0A\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca %union.w
store i32 0, i32* %1
%5 = call double @square(double 3.000000e-01)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %5)
%7 = call double @square(double 2.000000e+00)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %7)
%9 = call i32 (i32, ...) bitcast (i32 (...)* @add to i32 (i32, ...)*)(i32 2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 2)
store i32 0, i32* %2
br label %11
11: ; preds = %17, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %11
20: ; preds = %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = bitcast %union.w* %4 to i32*
store i32 1, i32* %22
%23 = bitcast %union.w* %4 to i8*
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 1
%27 = zext i1 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
@.str.1 = [7 x i8] c"%d,%d\0A\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.4 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call double @square(double 3.000000e-01)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call double @square(double 2.000000e+00)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @add to i32 (i32, ...)*)(i32 2)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 1)
ret i32 0
}