#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 *);
main() {
  int x, y;
  printf(" Введите значение x ");
  scanf("%d", &x);
  if (x <= 0) {
    y = (-2) * (x * x) + x + 1;
    printf("y=%d\n", y);
  }
  if (x > 0) {
    y = (-2) * (x * x) + 3;
    printf("y=%d\n", y);
  }
  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    0xee0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jg     117e <main+0x5e>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   $0xfffffffe,%eax,%eax
add    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   $0xfffffffe,%eax,%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe82(%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    0xeee(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jg     116d <main+0x4d>
mov    %eax,%ecx
imul   %ecx,%ecx
add    %ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1187 <main+0x67>
imul   %eax,%eax
add    %eax,%eax
mov    $0x3,%esi
sub    %eax,%esi
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c" \D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B7\D0\BD\D0\B0\D1\87\D0\B5\D0\BD\D0\B8\D0\B5 x \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"y=%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 ([36 x i8], [36 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 = icmp sle i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %0
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = mul nsw i32 %9, %10
%12 = mul nsw i32 -2, %11
%13 = load i32, i32* %2
%14 = add nsw i32 %12, %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %8, %0
%19 = load i32, i32* %2
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %2
%23 = load i32, i32* %2
%24 = mul nsw i32 %22, %23
%25 = mul nsw i32 -2, %24
%26 = add nsw i32 %25, 3
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %21, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c" \D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B7\D0\BD\D0\B0\D1\87\D0\B5\D0\BD\D0\B8\D0\B5 x \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"y=%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 ([36 x i8], [36 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 = icmp slt i32 %5, 1
br i1 %6, label %7, label %15
7: ; preds = %0
%8 = mul i32 %5, -2
%9 = mul i32 %8, %5
%10 = add nsw i32 %5, 1
%11 = add i32 %10, %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %0, %7
%16 = phi i32 [ %13, %7 ], [ %5, %0 ]
%17 = mul i32 %16, -2
%18 = mul i32 %17, %16
%19 = add nsw i32 %18, 3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %15, %7
ret i32 0
}