#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int debloatMenu(void) {
  int user_key;
  system("@cls||clear");
  printf("=======================================\n");
  printf("   Debloat menu                   |\n");
  printf("=======================================\n");
  printf("| [1] App debloat                 |\n");
  printf("| [2] Priv-app debloat            |\n");
  printf("| [9] Information about Debloat   |\n");
  printf("=======================================\n");
  printf("[0] Exit\n");
  scanf("%d", &user_key);
  switch (user_key) {
  case 0:
    printf("Goodbye! :P");
    return 0;
  case 1: {
    getchar();
    system("cd ~/*/workspace/system/app && rm -rf BasicDreams Email Exchange2 "
           "FMRadio Galaxy4 HoloSpiralWallpaper LiveWallpapers "
           "LiveWallpapersPicker NoiseField PhaseBeam PhotoPhase PhotoTable "
           "PicoTts PrintSpooler");
    printf("Done!\n");
    getchar();
    break;
  }
  case 2: {
    getchar();
    system("cd ~/*/workspace/system/priv-app && rm -rf "
           "BackupRestoreConfirmation CellBroadcastReceiver FusedLocation");
    printf("Done!\n");
    getchar();
    break;
  }
  case 9: {
    printf("\n[!]Debloat script delete this applications: BasicDreams, Email, "
           "Exchange2, FMRadio, Galaxy4, HoloSpiralWallpaper, LiveWallpapers, "
           "LiveWallpapersPicker, NoiseField, PhaseBeam, PhotoPhase, "
           "PhotoTable, PicoTts, PrintSpooler in 'app' folder\n");
    printf("\n[!]And this applications: BackupRestoreConfirmation, "
           "CellBroadcastReceiver, FusedLocation in 'priv-app' folder\n");
    getchar();
    printf("\n[!]Debloat script working only with 5.0 - 7.1 API versions. Work "
           "for lower version in progress\n");
    printf("\nPress 'ENTER' to continue...\n");
    getchar();
    printf("\n[!]Debloat function in this tool must be use for low end devices "
           "(or medium). This feature delete apps for increasing performance "
           "and free RAM\n");
    getchar();
    break;
  }
  default:
    printf("Make your choice!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<debloatMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed9(%rip),%rdi
call   1030 <system@plt>
lea    0xed9(%rip),%rdi
mov    %rdi,-0x18(%rbp)
call   1040 <printf@plt>
lea    0xef2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <printf@plt>
lea    0xf02(%rip),%rdi
call   1040 <printf@plt>
lea    0xf1b(%rip),%rdi
call   1040 <printf@plt>
lea    0xf34(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <printf@plt>
lea    0xf44(%rip),%rdi
call   1040 <printf@plt>
lea    0xf42(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     12ab <debloatMenu+0x16b>
mov    -0x10(%rbp),%rax
lea    0xe22(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf10(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12be <debloatMenu+0x17e>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xefd(%rip),%rdi
call   1030 <system@plt>
lea    0xfbb(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    12b7 <debloatMenu+0x177>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xfa3(%rip),%rdi
call   1030 <system@plt>
lea    0xf90(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    12b7 <debloatMenu+0x177>
lea    0xfe8(%rip),%rdi
call   1040 <printf@plt>
lea    0x10cb(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0x1129(%rip),%rdi
call   1040 <printf@plt>
lea    0x117e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0x118a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    12b7 <debloatMenu+0x177>
lea    0x1203(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debloatMenu>:
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
call   1040 <system@plt>
lea    0x109e(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xfff(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x100f(%rip),%rdi
call   1030 <puts@plt>
lea    0x1027(%rip),%rdi
call   1030 <puts@plt>
lea    0x103f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x1077(%rip),%rdi
call   1030 <puts@plt>
lea    0xe71(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x9,%rax
ja     1224 <debloatMenu+0xd4>
lea    0xe22(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
jmp    1283 <debloatMenu+0x133>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe3d(%rip),%rdi
jmp    1216 <debloatMenu+0xc6>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xef7(%rip),%rdi
call   1040 <system@plt>
lea    0x1281(%rip),%rdi
jmp    1277 <debloatMenu+0x127>
lea    0x127e(%rip),%rdi
call   1030 <puts@plt>
jmp    1283 <debloatMenu+0x133>
lea    0xffe(%rip),%rdi
call   1030 <puts@plt>
lea    0x10e0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0x113d(%rip),%rdi
call   1030 <puts@plt>
lea    0x1191(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0x119c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"@cls||clear\00"
@.str.1 = [41 x i8] c"=======================================\0A\00"
@.str.2 = [37 x i8] c" Debloat menu |\0A\00"
@.str.3 = [37 x i8] c"| [1] App debloat |\0A\00"
@.str.4 = [37 x i8] c"| [2] Priv-app debloat |\0A\00"
@.str.5 = [37 x i8] c"| [9] Information about Debloat |\0A\00"
@.str.6 = [10 x i8] c"[0] Exit\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [12 x i8] c"Goodbye! :P\00"
@.str.9 = [202 x i8] c"cd ~/*/workspace/system/app && rm -rf BasicDreams Email Exchange2 FMRadio Galaxy4 HoloSpiralWallpaper LiveWallpapers LiveWallpapersPicker NoiseField PhaseBeam PhotoPhase PhotoTable PicoTts PrintSpooler\00"
@.str.10 = [7 x i8] c"Done!\0A\00"
@.str.11 = [105 x i8] c"cd ~/*/workspace/system/priv-app && rm -rf BackupRestoreConfirmation CellBroadcastReceiver FusedLocation\00"
@.str.12 = [239 x i8] c"\0A[!]Debloat script delete this applications: BasicDreams, Email, Exchange2, FMRadio, Galaxy4, HoloSpiralWallpaper, LiveWallpapers, LiveWallpapersPicker, NoiseField, PhaseBeam, PhotoPhase, PhotoTable, PicoTts, PrintSpooler in 'app' folder\0A\00"
@.str.13 = [113 x i8] c"\0A[!]And this applications: BackupRestoreConfirmation, CellBroadcastReceiver, FusedLocation in 'priv-app' folder\0A\00"
@.str.14 = [97 x i8] c"\0A[!]Debloat script working only with 5.0 - 7.1 API versions. Work for lower version in progress\0A\00"
@.str.15 = [31 x i8] c"\0APress 'ENTER' to continue...\0A\00"
@.str.16 = [145 x i8] c"\0A[!]Debloat function in this tool must be use for low end devices (or medium). This feature delete apps for increasing performance and free RAM\0A\00"
@.str.17 = [19 x i8] c"Make your choice!\0A\00"
define i32 @debloatMenu() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
switch i32 %13, label %35 [
i32 0, label %14
i32 1, label %16
i32 2, label %21
i32 9, label %26
]
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %38
16: ; preds = %0
%17 = call i32 (...) @getchar()
%18 = call i32 @system(i8* getelementptr inbounds ([202 x i8], [202 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%20 = call i32 (...) @getchar()
br label %37
21: ; preds = %0
%22 = call i32 (...) @getchar()
%23 = call i32 @system(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.11, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%25 = call i32 (...) @getchar()
br label %37
26: ; preds = %0
%27 = call i32 @printf(i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str.12, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.13, i64 0, i64 0))
%29 = call i32 (...) @getchar()
%30 = call i32 @printf(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.14, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0))
%32 = call i32 (...) @getchar()
%33 = call i32 @printf(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.16, i64 0, i64 0))
%34 = call i32 (...) @getchar()
br label %37
35: ; preds = %0
%36 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0))
br label %37
37: ; preds = %35, %26, %21, %16
store i32 0, i32* %1
br label %38
38: ; preds = %37, %14
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [12 x i8] c"@cls||clear\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [12 x i8] c"Goodbye! :P\00"
@.str.9 = [202 x i8] c"cd ~/*/workspace/system/app && rm -rf BasicDreams Email Exchange2 FMRadio Galaxy4 HoloSpiralWallpaper LiveWallpapers LiveWallpapersPicker NoiseField PhaseBeam PhotoPhase PhotoTable PicoTts PrintSpooler\00"
@.str.11 = [105 x i8] c"cd ~/*/workspace/system/priv-app && rm -rf BackupRestoreConfirmation CellBroadcastReceiver FusedLocation\00"
@str.18 = [36 x i8] c" Debloat menu |\00"
@str.20 = [36 x i8] c"| [1] App debloat |\00"
@str.21 = [36 x i8] c"| [2] Priv-app debloat |\00"
@str.22 = [36 x i8] c"| [9] Information about Debloat |\00"
@str.23 = [40 x i8] c"=======================================\00"
@str.24 = [9 x i8] c"[0] Exit\00"
@str.25 = [238 x i8] c"\0A[!]Debloat script delete this applications: BasicDreams, Email, Exchange2, FMRadio, Galaxy4, HoloSpiralWallpaper, LiveWallpapers, LiveWallpapersPicker, NoiseField, PhaseBeam, PhotoPhase, PhotoTable, PicoTts, PrintSpooler in 'app' folder\00"
@str.26 = [112 x i8] c"\0A[!]And this applications: BackupRestoreConfirmation, CellBroadcastReceiver, FusedLocation in 'priv-app' folder\00"
@str.27 = [96 x i8] c"\0A[!]Debloat script working only with 5.0 - 7.1 API versions. Work for lower version in progress\00"
@str.28 = [30 x i8] c"\0APress 'ENTER' to continue...\00"
@str.29 = [144 x i8] c"\0A[!]Debloat function in this tool must be use for low end devices (or medium). This feature delete apps for increasing performance and free RAM\00"
@str.31 = [6 x i8] c"Done!\00"
@str.32 = [18 x i8] c"Make your choice!\00"
define i32 @debloatMenu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.23, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.18, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.23, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.20, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.22, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.23, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.24, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
switch i32 %13, label %35 [
i32 0, label %14
i32 1, label %16
i32 2, label %21
i32 9, label %26
]
14: ; preds = %0
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %37
16: ; preds = %0
%17 = call i32 (...) @getchar()
%18 = call i32 @system(i8* getelementptr inbounds ([202 x i8], [202 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.31, i64 0, i64 0))
%20 = call i32 (...) @getchar()
br label %37
21: ; preds = %0
%22 = call i32 (...) @getchar()
%23 = call i32 @system(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.11, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.31, i64 0, i64 0))
%25 = call i32 (...) @getchar()
br label %37
26: ; preds = %0
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([238 x i8], [238 x i8]* @str.25, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([112 x i8], [112 x i8]* @str.26, i64 0, i64 0))
%29 = call i32 (...) @getchar()
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @str.27, i64 0, i64 0))
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.28, i64 0, i64 0))
%32 = call i32 (...) @getchar()
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([144 x i8], [144 x i8]* @str.29, i64 0, i64 0))
%34 = call i32 (...) @getchar()
br label %37
35: ; preds = %0
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.32, i64 0, i64 0))
br label %37
37: ; preds = %16, %21, %26, %35, %14
ret i32 0
}