#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 m, n, prima, seconda, terza, quarta, option;
  printf("Scegli l'opzione che desiderei\n1) Cripta\n2) Decripta\n");
  scanf("%d", &option);
  switch (option) {
  case 1:
    printf("Inserisci il numero da criptare (quattro cifre): ");
    scanf("%d", &n);
    prima = (n / 1000 + 7) % 10;
    seconda = ((n / 100) % 10 + 7) % 10;
    terza = ((n / 10) % 10 + 7) % 10;
    quarta = (n % 10 + 7) % 10;
    m = terza * 1000 + quarta * 100 + prima * 10 + seconda;
    printf("Il tuo numero è: %d", m);
    break;
  case 2:
    printf("Inserisci il numero da decriptare(quattro cifre): ");
    scanf("%d", &n);
    prima = (n / 1000 + 3) % 10;
    seconda = ((n / 100) % 10 + 3) % 10;
    terza = ((n / 10) % 10 + 3) % 10;
    quarta = (n % 10 + 3) % 10;
    m = terza * 1000 + quarta * 100 + prima * 10 + seconda;
    printf("Il tuo numero è: %d", m);
    break;
  default:
    printf("il numero inserito non è valido.");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf36(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x1,%eax
je     1172 <main+0x52>
jmp    1161 <main+0x41>
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
je     1239 <main+0x119>
jmp    1300 <main+0x1e0>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
imul   $0x3e8,-0x18(%rbp),%eax
imul   $0x64,-0x1c(%rbp),%ecx
add    %ecx,%eax
imul   $0xa,-0x10(%rbp),%ecx
add    %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130e <main+0x1ee>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    $0x3,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x3,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x3,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x3,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
imul   $0x3e8,-0x18(%rbp),%eax
imul   $0x64,-0x1c(%rbp),%ecx
add    %ecx,%eax
imul   $0xa,-0x10(%rbp),%ecx
add    %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130e <main+0x1ee>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf64(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1279 <main+0x149>
cmp    $0x1,%eax
jne    13cc <main+0x29c>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movslq (%rsp),%rcx
imul   $0x10624dd3,%rcx,%rax
mov    %rax,%rdx
sar    $0x26,%rdx
shr    $0x3f,%rax
add    %edx,%eax
add    $0x7,%eax
movslq %eax,%r9
imul   $0x66666667,%r9,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%r9d
imul   $0x51eb851f,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rdx
add    %esi,%edx
movslq %edx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
shr    $0x22,%rsi
add    %edi,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
add    $0x7,%dl
movsbl %dl,%edx
imul   $0x67,%edx,%esi
movzwl %si,%edi
shr    $0xa,%esi
shr    $0xf,%edi
add    %sil,%dil
movzbl %dil,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %sil,%dl
movsbl %dl,%r8d
imul   $0x66666667,%rcx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
movslq %esi,%rsi
imul   $0x66666667,%rsi,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rdi
add    %edx,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%edx
mov    %esi,%edi
sub    %edx,%edi
add    $0x7,%dil
movsbl %dil,%edx
imul   $0x67,%edx,%edi
movzwl %di,%eax
shr    $0xa,%edi
shr    $0xf,%eax
add    %dil,%al
movzbl %al,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%dl
movsbl %dl,%edi
add    %esi,%esi
lea    (%rsi,%rsi,4),%eax
sub    %eax,%ecx
add    $0x7,%cl
jmp    1389 <main+0x259>
lea    0xdc7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb6(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movslq (%rsp),%rcx
imul   $0x10624dd3,%rcx,%rax
mov    %rax,%rdx
sar    $0x26,%rdx
shr    $0x3f,%rax
add    %edx,%eax
add    $0x3,%eax
movslq %eax,%r9
imul   $0x66666667,%r9,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%r9d
imul   $0x51eb851f,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rdx
add    %esi,%edx
movslq %edx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
shr    $0x22,%rsi
add    %edi,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
add    $0x3,%dl
movsbl %dl,%edx
imul   $0x67,%edx,%esi
movzwl %si,%edi
shr    $0xa,%esi
shr    $0xf,%edi
add    %sil,%dil
movzbl %dil,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %sil,%dl
movsbl %dl,%r8d
imul   $0x66666667,%rcx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
movslq %esi,%rsi
imul   $0x66666667,%rsi,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rdi
add    %edx,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%edx
mov    %esi,%edi
sub    %edx,%edi
add    $0x3,%dil
movsbl %dil,%edx
imul   $0x67,%edx,%edi
movzwl %di,%eax
shr    $0xa,%edi
shr    $0xf,%eax
add    %dil,%al
movzbl %al,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%dl
movsbl %dl,%edi
add    %esi,%esi
lea    (%rsi,%rsi,4),%eax
sub    %eax,%ecx
add    $0x3,%cl
movsbl %cl,%eax
imul   $0x67,%eax,%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%eax
imul   $0x3e8,%edi,%ecx
imul   $0x64,%eax,%eax
lea    (%r9,%r9,4),%edx
lea    (%rax,%rdx,2),%esi
add    %r8d,%esi
add    %ecx,%esi
lea    0xc6f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13da <main+0x2aa>
lea    0xca7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Scegli l'opzione che desiderei\0A1) Cripta\0A2) Decripta\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Inserisci il numero da criptare (quattro cifre): \00"
@.str.3 = [21 x i8] c"Il tuo numero \C3\A8: %d\00"
@.str.4 = [51 x i8] c"Inserisci il numero da decriptare(quattro cifre): \00"
@.str.5 = [34 x i8] c"il numero inserito non \C3\A8 valido.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%11 = load i32, i32* %8
switch i32 %11, label %78 [
i32 1, label %12
i32 2, label %45
]
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = sdiv i32 %15, 1000
%17 = add nsw i32 %16, 7
%18 = srem i32 %17, 10
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = sdiv i32 %19, 100
%21 = srem i32 %20, 10
%22 = add nsw i32 %21, 7
%23 = srem i32 %22, 10
store i32 %23, i32* %5
%24 = load i32, i32* %3
%25 = sdiv i32 %24, 10
%26 = srem i32 %25, 10
%27 = add nsw i32 %26, 7
%28 = srem i32 %27, 10
store i32 %28, i32* %6
%29 = load i32, i32* %3
%30 = srem i32 %29, 10
%31 = add nsw i32 %30, 7
%32 = srem i32 %31, 10
store i32 %32, i32* %7
%33 = load i32, i32* %6
%34 = mul nsw i32 %33, 1000
%35 = load i32, i32* %7
%36 = mul nsw i32 %35, 100
%37 = add nsw i32 %34, %36
%38 = load i32, i32* %4
%39 = mul nsw i32 %38, 10
%40 = add nsw i32 %37, %39
%41 = load i32, i32* %5
%42 = add nsw i32 %40, %41
store i32 %42, i32* %2
%43 = load i32, i32* %2
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %43)
br label %80
45: ; preds = %0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%48 = load i32, i32* %3
%49 = sdiv i32 %48, 1000
%50 = add nsw i32 %49, 3
%51 = srem i32 %50, 10
store i32 %51, i32* %4
%52 = load i32, i32* %3
%53 = sdiv i32 %52, 100
%54 = srem i32 %53, 10
%55 = add nsw i32 %54, 3
%56 = srem i32 %55, 10
store i32 %56, i32* %5
%57 = load i32, i32* %3
%58 = sdiv i32 %57, 10
%59 = srem i32 %58, 10
%60 = add nsw i32 %59, 3
%61 = srem i32 %60, 10
store i32 %61, i32* %6
%62 = load i32, i32* %3
%63 = srem i32 %62, 10
%64 = add nsw i32 %63, 3
%65 = srem i32 %64, 10
store i32 %65, i32* %7
%66 = load i32, i32* %6
%67 = mul nsw i32 %66, 1000
%68 = load i32, i32* %7
%69 = mul nsw i32 %68, 100
%70 = add nsw i32 %67, %69
%71 = load i32, i32* %4
%72 = mul nsw i32 %71, 10
%73 = add nsw i32 %70, %72
%74 = load i32, i32* %5
%75 = add nsw i32 %73, %74
store i32 %75, i32* %2
%76 = load i32, i32* %2
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %76)
br label %80
78: ; preds = %0
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %80
80: ; preds = %78, %45, %12
%81 = load i32, i32* %1
ret i32 %81
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Inserisci il numero da criptare (quattro cifre): \00"
@.str.3 = [21 x i8] c"Il tuo numero \C3\A8: %d\00"
@.str.4 = [51 x i8] c"Inserisci il numero da decriptare(quattro cifre): \00"
@.str.5 = [34 x i8] c"il numero inserito non \C3\A8 valido.\00"
@str = [53 x i8] c"Scegli l'opzione che desiderei\0A1) Cripta\0A2) Decripta\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
switch i32 %7, label %70 [
i32 1, label %8
i32 2, label %39
]
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %12, 7
%14 = srem i32 %13, 10
%15 = sdiv i32 %11, 100
%16 = srem i32 %15, 10
%17 = trunc i32 %16 to i8
%18 = add nsw i8 %17, 7
%19 = srem i8 %18, 10
%20 = sext i8 %19 to i32
%21 = sdiv i32 %11, 10
%22 = srem i32 %21, 10
%23 = trunc i32 %22 to i8
%24 = add nsw i8 %23, 7
%25 = srem i8 %24, 10
%26 = sext i8 %25 to i32
%27 = srem i32 %11, 10
%28 = trunc i32 %27 to i8
%29 = add nsw i8 %28, 7
%30 = srem i8 %29, 10
%31 = sext i8 %30 to i32
%32 = mul nsw i32 %26, 1000
%33 = mul nsw i32 %31, 100
%34 = mul nsw i32 %14, 10
%35 = add nsw i32 %33, %34
%36 = add nsw i32 %35, %20
%37 = add nsw i32 %36, %32
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %72
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%42 = load i32, i32* %1
%43 = sdiv i32 %42, 1000
%44 = add nsw i32 %43, 3
%45 = srem i32 %44, 10
%46 = sdiv i32 %42, 100
%47 = srem i32 %46, 10
%48 = trunc i32 %47 to i8
%49 = add nsw i8 %48, 3
%50 = srem i8 %49, 10
%51 = sext i8 %50 to i32
%52 = sdiv i32 %42, 10
%53 = srem i32 %52, 10
%54 = trunc i32 %53 to i8
%55 = add nsw i8 %54, 3
%56 = srem i8 %55, 10
%57 = sext i8 %56 to i32
%58 = srem i32 %42, 10
%59 = trunc i32 %58 to i8
%60 = add nsw i8 %59, 3
%61 = srem i8 %60, 10
%62 = sext i8 %61 to i32
%63 = mul nsw i32 %57, 1000
%64 = mul nsw i32 %62, 100
%65 = mul nsw i32 %45, 10
%66 = add nsw i32 %64, %65
%67 = add nsw i32 %66, %51
%68 = add nsw i32 %67, %63
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %68)
br label %72
70: ; preds = %0
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %70, %39, %8
ret i32 0
}