#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 main(void) {
  int a = 5;
  int b = 100;
  printf("SQUARE(%d) = %d\n", a, ({
           int _y = (a);
           _y *_y;
         }));
  printf("SQUARE(%d) = %d\n", a + 2, ({
           int _y = (a + 2);
           _y *_y;
         }));
  printf("result = %d\n", b / ({
                            int _y = (a);
                            _y *_y;
                          }));
  printf("result = %d\n", ({
           int _y = (a++);
           _y *_y;
         }));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    $0x2,%esi
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
imul   -0x20(%rbp),%ecx
mov    %ecx,-0x24(%rbp)
cltd
idivl  -0x24(%rbp)
mov    %eax,%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x19,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x31,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"SQUARE(%d) = %d\0A\00"
@.str.1 = [13 x i8] c"result = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
store i32 100, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %2
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = load i32, i32* %4
%16 = mul nsw i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %17)
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 2
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 2
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = load i32, i32* %6
%25 = mul nsw i32 %23, %24
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %26)
%28 = load i32, i32* %3
%29 = load i32, i32* %2
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %8
%32 = mul nsw i32 %30, %31
store i32 %32, i32* %9
%33 = load i32, i32* %9
%34 = sdiv i32 %28, %33
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
store i32 %36, i32* %10
%38 = load i32, i32* %10
%39 = load i32, i32* %10
%40 = mul nsw i32 %38, %39
store i32 %40, i32* %11
%41 = load i32, i32* %11
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"SQUARE(%d) = %d\0A\00"
@.str.1 = [13 x i8] c"result = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 5, i32 25)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 7, i32 49)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 4)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 25)
ret i32 0
}