#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x, m = 0, n = 0;
  int count = 0;
  scanf("%d", &n);
  m = n;
  while (m > 0) {
    m = m / 10;
    count++;
  }
  x = (int)pow(10, count - 1);
  m = n % x - n % 10 + n / x + (n % 10) * x;
  printf("%d", m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea5(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1190 <main+0x60>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116a <main+0x3a>
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x20(%rbp),%edx
sub    %eax,%edx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
imul   -0x8(%rbp),%edx
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xec0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    $0xffffffff,%esi
test   %eax,%eax
jle    1174 <main+0x44>
mov    $0xcccccccd,%ecx
nopl   0x0(%rax)
mov    %eax,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%esi
cmp    $0x9,%eax
mov    %edx,%eax
ja     1160 <main+0x30>
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %rax,%r8
movslq 0x4(%rsp),%rsi
mov    %esi,%eax
cltd
idiv   %r8d
imul   $0x66666667,%rsi,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdi
add    %ecx,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%ecx
sub    %ecx,%esi
sub    %esi,%edx
add    %edx,%eax
imul   %r8d,%esi
add    %eax,%esi
lea    0xe48(%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
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = load i32, i32* %4
store i32 %7, i32* %3
br label %8
8: ; preds = %11, %0
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sdiv i32 %12, 10
store i32 %13, i32* %3
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %8
16: ; preds = %8
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = call i64 @pow(i32 10, i32 %18)
%20 = trunc i64 %19 to i32
store i32 %20, i32* %2
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = srem i32 %21, %22
%24 = load i32, i32* %4
%25 = srem i32 %24, 10
%26 = sub nsw i32 %23, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = sdiv i32 %27, %28
%30 = add nsw i32 %26, %29
%31 = load i32, i32* %4
%32 = srem i32 %31, 10
%33 = load i32, i32* %2
%34 = mul nsw i32 %32, %33
%35 = add nsw i32 %30, %34
store i32 %35, i32* %3
%36 = load i32, i32* %3
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%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 sgt i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ 0, %0 ]
%8 = phi i32 [ %9, %6 ], [ %4, %0 ]
%9 = udiv i32 %8, 10
%10 = add nuw nsw i32 %7, 1
%11 = icmp ult i32 %8, 10
br i1 %11, label %12, label %6
12: ; preds = %6, %0
%13 = phi i32 [ -1, %0 ], [ %7, %6 ]
%14 = call i64 @pow(i32 10, i32 %13)
%15 = trunc i64 %14 to i32
%16 = load i32, i32* %1
%17 = srem i32 %16, %15
%18 = srem i32 %16, 10
%19 = sub i32 %17, %18
%20 = sdiv i32 %16, %15
%21 = add nsw i32 %19, %20
%22 = mul nsw i32 %18, %15
%23 = add nsw i32 %21, %22
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}