#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 find_f(int, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ shift_left(int, int, int *, int);
int /*<<< orphan*/ shift_right(int, int, int *, int);
int main() {
  int size, _j, _i;
  printf("Введите количество элементов: ");
  scanf("%d", &size);
  printf("Введите массив: ");
  int arr[size];
  for (int i = 0; i < size; i++)
    scanf("%d", &arr[i]);
  printf("Введите i: ");
  scanf("%d", &_i);
  printf("Введите j: ");
  scanf("%d", &_j);
  printf("\n");
  int pos_j = find_f(_j, arr, size), pos_i = find_f(_i, arr, size);
  shift_left(_j, pos_i, arr, size);
  shift_right(_i, pos_j, arr, size);
  for (int i = 0; i < size; ++i) {
    printf("%d ", arr[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x39(%rbp)
call   1050 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x39(%rbp),%al
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f2 <main+0xa2>
mov    -0x38(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5a(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bd <main+0x6d>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe32(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe14(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rsi
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%edx
call   1040 <find_f@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%edx
call   1040 <find_f@plt>
mov    -0x38(%rbp),%rdx
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x8(%rbp),%ecx
call   1070 <shift_left@plt>
mov    -0x38(%rbp),%rdx
mov    -0x10(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x8(%rbp),%ecx
call   1030 <shift_right@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12be <main+0x16e>
mov    -0x38(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    128b <main+0x13b>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    11ec <main+0x8c>
xor    %r13d,%r13d
lea    0xe71(%rip),%r15
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r13
jl     11d0 <main+0x70>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe38(%rip),%rbx
lea    -0x30(%rbp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x34(%rbp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    -0x34(%rbp),%edi
mov    -0x2c(%rbp),%edx
mov    %r14,%rsi
call   1050 <find_f@plt>
mov    %eax,%ebx
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%edx
mov    %r14,%rsi
call   1050 <find_f@plt>
mov    -0x34(%rbp),%edi
mov    -0x2c(%rbp),%ecx
mov    %eax,%esi
mov    %r14,%rdx
call   1080 <shift_left@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%ecx
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <shift_right@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    129b <main+0x13b>
lea    0xe04(%rip),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     1280 <main+0x120>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BA\D0\BE\D0\BB\D0\B8\D1\87\D0\B5\D1\81\D1\82\D0\B2\D0\BE \D1\8D\D0\BB\D0\B5\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BC\D0\B0\D1\81\D1\81\D0\B8\D0\B2: \00"
@.str.3 = [19 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 i: \00"
@.str.4 = [19 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 j: \00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %5
%17 = alloca i32, i64 %15
store i64 %15, i64* %6
store i32 0, i32* %7
br label %18
18: ; preds = %27, %0
%19 = load i32, i32* %7
%20 = load i32, i32* %2
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %30
22: ; preds = %18
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %17, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
br label %27
27: ; preds = %22
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %18
30: ; preds = %18
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = call i32 @find_f(i32 %36, i32* %17, i32 %37)
store i32 %38, i32* %8
%39 = load i32, i32* %4
%40 = load i32, i32* %2
%41 = call i32 @find_f(i32 %39, i32* %17, i32 %40)
store i32 %41, i32* %9
%42 = load i32, i32* %3
%43 = load i32, i32* %9
%44 = load i32, i32* %2
%45 = call i32 @shift_left(i32 %42, i32 %43, i32* %17, i32 %44)
%46 = load i32, i32* %4
%47 = load i32, i32* %8
%48 = load i32, i32* %2
%49 = call i32 @shift_right(i32 %46, i32 %47, i32* %17, i32 %48)
store i32 0, i32* %10
br label %50
50: ; preds = %60, %30
%51 = load i32, i32* %10
%52 = load i32, i32* %2
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %63
54: ; preds = %50
%55 = load i32, i32* %10
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %17, i64 %56
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %54
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
store i32 %62, i32* %10
br label %50
63: ; preds = %50
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
%65 = load i8*, i8** %5
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
@.str = [57 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BA\D0\BE\D0\BB\D0\B8\D1\87\D0\B5\D1\81\D1\82\D0\B2\D0\BE \D1\8D\D0\BB\D0\B5\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BC\D0\B0\D1\81\D1\81\D0\B8\D0\B2: \00"
@.str.3 = [19 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 i: \00"
@.str.4 = [19 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 j: \00"
@.str.6 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
%13 = alloca i32, i64 %11
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %36, label %16
16: ; preds = %36, %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%21 = call i32 @putchar(i32 10)
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = call i32 @find_f(i32 %22, i32* %13, i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %1
%27 = call i32 @find_f(i32 %25, i32* %13, i32 %26)
%28 = load i32, i32* %2
%29 = load i32, i32* %1
%30 = call i32 @shift_left(i32 %28, i32 %27, i32* %13, i32 %29)
%31 = load i32, i32* %3
%32 = load i32, i32* %1
%33 = call i32 @shift_right(i32 %31, i32 %24, i32* %13, i32 %32)
%34 = load i32, i32* %1
%35 = icmp sgt i32 %34, 0
br i1 %35, label %46, label %44
36: ; preds = %0, %36
%37 = phi i64 [ %40, %36 ], [ 0, %0 ]
%38 = getelementptr inbounds i32, i32* %13, i64 %37
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %38)
%40 = add nuw nsw i64 %37, 1
%41 = load i32, i32* %1
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %40, %42
br i1 %43, label %36, label %16
44: ; preds = %46, %16
%45 = call i32 @putchar(i32 10)
ret i32 0
46: ; preds = %16, %46
%47 = phi i64 [ %51, %46 ], [ 0, %16 ]
%48 = getelementptr inbounds i32, i32* %13, i64 %47
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %49)
%51 = add nuw nsw i64 %47, 1
%52 = load i32, i32* %1
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %51, %53
br i1 %54, label %46, label %44
}