#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x, y;
  scanf("%d", &x);
  if (x < 0)
    printf("%d", y = x * x);
  else {
    if (x >= 0 && x < 5)
      printf("%d", y = 2 * x + 1);
    else
      printf("%d", y = 3 * x - 12);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1164 <main+0x44>
mov    -0x8(%rbp),%esi
imul   -0x8(%rbp),%esi
mov    %esi,-0xc(%rbp)
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
cmpl   $0x0,-0x8(%rbp)
jl     1195 <main+0x75>
cmpl   $0x5,-0x8(%rbp)
jge    1195 <main+0x75>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
jmp    11ab <main+0x8b>
imul   $0x3,-0x8(%rbp),%esi
sub    $0xc,%esi
mov    %esi,-0xc(%rbp)
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
js     1146 <main+0x26>
cmp    $0x4,%esi
ja     114b <main+0x2b>
add    %esi,%esi
add    $0x1,%esi
jmp    1151 <main+0x31>
imul   %esi,%esi
jmp    1151 <main+0x31>
lea    (%rsi,%rsi,2),%esi
add    $0xfffffff4,%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %29
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32, i32* %2
%20 = mul nsw i32 2, %19
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %28
23: ; preds = %15, %12
%24 = load i32, i32* %2
%25 = mul nsw i32 3, %24
%26 = sub nsw i32 %25, 12
store i32 %26, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %23, %18
br label %29
29: ; preds = %28, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = mul nsw i32 %4, %4
br label %16
8: ; preds = %0
%9 = icmp ult i32 %4, 5
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = shl nuw nsw i32 %4, 1
%12 = or i32 %11, 1
br label %16
13: ; preds = %8
%14 = mul nsw i32 %4, 3
%15 = add nsw i32 %14, -12
br label %16
16: ; preds = %10, %13, %6
%17 = phi i32 [ %12, %10 ], [ %15, %13 ], [ %7, %6 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
}