#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 /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int x, result;
  printf("Enter x: ");
  scanf("%d", &x);
  result = ((((((((((3 * x) + 2) * x) - 5) * x) - 1) * x) + 7) * x) - 6);
  printf("Result = %d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
imul   $0x3,-0x8(%rbp),%eax
add    $0x2,%eax
imul   -0x8(%rbp),%eax
sub    $0x5,%eax
imul   -0x8(%rbp),%eax
sub    $0x1,%eax
imul   -0x8(%rbp),%eax
add    $0x7,%eax
imul   -0x8(%rbp),%eax
sub    $0x6,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    (%rax,%rax,2),%esi
add    $0x2,%esi
imul   %eax,%esi
add    $0xfffffffb,%esi
imul   %eax,%esi
add    $0xffffffff,%esi
imul   %eax,%esi
add    $0x7,%esi
imul   %eax,%esi
add    $0xfffffffa,%esi
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Enter x: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Result = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = mul nsw i32 3, %6
%8 = add nsw i32 %7, 2
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
%11 = sub nsw i32 %10, 5
%12 = load i32, i32* %2
%13 = mul nsw i32 %11, %12
%14 = sub nsw i32 %13, 1
%15 = load i32, i32* %2
%16 = mul nsw i32 %14, %15
%17 = add nsw i32 %16, 7
%18 = load i32, i32* %2
%19 = mul nsw i32 %17, %18
%20 = sub nsw i32 %19, 6
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter x: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Result = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, 3
%7 = add nsw i32 %6, 2
%8 = mul nsw i32 %7, %5
%9 = add nsw i32 %8, -5
%10 = mul nsw i32 %9, %5
%11 = add nsw i32 %10, -1
%12 = mul nsw i32 %11, %5
%13 = add nsw i32 %12, 7
%14 = mul nsw i32 %13, %5
%15 = add nsw i32 %14, -6
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 0
}