#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() {
  int x, y;
  printf("input x:");
  scanf("%d", &x);
  if (x < 1) {
    y = x;
    printf("y = x = %d\n", y);
  } else if (x < 10) {
    y = 2 * x - 1;
    printf("y = 2*x-1 = %d\n", y);
  } else {
    y = 3 * x - 11;
    printf("y = 3*x-11 = %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    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jge    1173 <main+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <main+0x9f>
cmpl   $0xa,-0x8(%rbp)
jge    119f <main+0x7f>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ba <main+0x9a>
imul   $0x3,-0x8(%rbp),%eax
sub    $0xb,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <main+0x9f>
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    0xed3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    115b <main+0x3b>
cmp    $0x9,%esi
ja     1164 <main+0x44>
add    %esi,%esi
add    $0xffffffff,%esi
lea    0xebf(%rip),%rdi
jmp    1171 <main+0x51>
lea    0xeaa(%rip),%rdi
jmp    1171 <main+0x51>
lea    (%rsi,%rsi,2),%esi
add    $0xfffffff5,%esi
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"input x:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"y = x = %d\0A\00"
@.str.3 = [16 x i8] c"y = 2*x-1 = %d\0A\00"
@.str.4 = [17 x i8] c"y = 3*x-11 = %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 ([9 x i8], [9 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 slt i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %2
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %28
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %2
%17 = mul nsw i32 2, %16
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %27
21: ; preds = %12
%22 = load i32, i32* %2
%23 = mul nsw i32 3, %22
%24 = sub nsw i32 %23, 11
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %21, %15
br label %28
28: ; preds = %27, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"input x:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"y = x = %d\0A\00"
@.str.3 = [16 x i8] c"y = 2*x-1 = %d\0A\00"
@.str.4 = [17 x i8] c"y = 3*x-11 = %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 ([9 x i8], [9 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 %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %5)
br label %19
9: ; preds = %0
%10 = icmp ult i32 %5, 10
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = shl nuw nsw i32 %5, 1
%13 = add nsw i32 %12, -1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %19
15: ; preds = %9
%16 = mul nsw i32 %5, 3
%17 = add nsw i32 %16, -11
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %11, %15, %7
ret i32 0
}