#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 EXIT_SUCCESS;
int /*<<< orphan*/ F_OK;
int /*<<< orphan*/ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ kext_admin(int, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int show_error(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
int recovery(unsigned int id, char src[]) {
  char cmd[300];
  char _identifier[15];
  char location[100];
  char confirm[2];
  switch (id) {
  case 68:
    kext_admin(42, src);
    break;
  case 64:
    printf("Do you have a working Ethernet/Wifi? (y/n): ");
    scanf("%s", confirm);
    if (confirm[0] == 'y') {
      printf("Reseting network preferences...\n");
      system("cd /Library/Preferences/SystemConfiguration/ && rm "
             "NetworkInterfaces.plist preferences.plist");
    } else
      return show_error("You need to use Null Ethernet Network. Visit "
                        "http://bit.ly/null-ethernet for details.");
    printf("Done.\nDo you want to restart now? (y/n): ");
    scanf("%s", confirm);
    if (confirm[0] == 'y')
      system("sudo shutdown -r now \"Restarting...\"");
    else
      printf("You choose not to restart now.\n");
    break;
  case 65:
    if (system("fsck -fy && mount -uw /") != 0)
      return show_error("Init failed! This usually occurs because of the user "
                        "being not logged in single user mode.");
  case 67:
    if (system("sudo touch /S*/L*/Extensions && sudo kextcache -Boot -U /") !=
        0)
      return show_error("Operation failed!");
    break;
  case 66:
    if (system("diskutil list") != 0)
      return show_error("You cannot do this operation in single user mode!");
    printf("Enter the \e[1;30mIDENTIFIER\e[0m of the USB partition to install "
           "machelper (e.g. disk1s2): ");
    scanf("%s", _identifier);
    system("mkdir /tmp/usb_helper/");
    sprintf(cmd, "diskutil unmount force %s", _identifier);
    system(cmd);
    sprintf(cmd, "diskutil mount -mountPoint /tmp/usb_helper/ %s", _identifier);
    system(cmd);
    if (access("/usr/bin/machelper", F_OK) == 0)
      strcpy(location, "/usr/bin/machelper");
    else
      strcpy(location, "machelper");
    printf("Copying machelper...\n");
    if (access("/tmp/usb_helper/usr/bin/", F_OK) == 0) {
      sprintf(cmd, "cp %s /tmp/usb_helper/usr/bin/", location);
      system(cmd);
    }
    sprintf(cmd, "diskutil unmount %s", _identifier);
    system(cmd);
    system("rmdir /tmp/usb_helper");
    break;
  case 69:
    if (access(src, F_OK)) {
      printf("Backing up kernel...\n");
      system("cp /System/Library/Kernels/kernel ~/Desktop/kernel_backup");
      if (system(cmd) == 0)
        printf("Kernel is backed up at ~/Desktop/\n");
      printf("Replacing kernel...\n");
      sprintf(cmd, "sudo cp %s /System/Library/Kernels/kernel", src);
      if (system(cmd) != 0)
        return show_error("Replacing kernel failed!");
    } else
      return show_error("Unresolved source.");
    break;
  case 62:
    printf("Disabling Hibernation...\n");
    if (system("sudo pmset -a hibernatemode 0 && sudo rm /var/vm/sleepimage && "
               "sudo mkdir /var/vm/sleepimage") != 0)
      return show_error("Disabling hibernation failed!");
    break;
  case 61:
    if (system("diskutil list") != 0)
      return show_error("You cannot do this operation in single user mode!");
    printf("\e[4mBe careful with this options\e[0m, as choosing wrong value(s) "
           "may cause important data to be wiped not knowingly.\n");
    printf(
        "Enter the \e[1;30mIDENTIFIER\e[0m of the USB device (e.g. disk1): ");
    scanf("%s", _identifier);
    strcat(_identifier, "s1");
    sprintf(cmd, "diskutil unmount force %s", _identifier);
    system(cmd);
    system("mkdir /tmp/efi_usb");
    sprintf(cmd, "diskutil mount -mountPoint /tmp/efi_usb %s", _identifier);
    system(cmd);
    printf("Enter the \e[1;30mIDENTIFIER\e[0m of the HDD/SSD (e.g. disk0): ");
    scanf("%s", _identifier);
    strcat(_identifier, "s1");
    sprintf(cmd, "diskutil unmount force %s", _identifier);
    system(cmd);
    system("mkdir /tmp/efi_hdd");
    sprintf(cmd, "diskutil mount -mountPoint /tmp/efi_hdd %s", _identifier);
    system(cmd);
    printf("Copying Clover...\n");
    if (access("/tmp/efi_hdd/EFI/CLOVER", F_OK) == 0) {
      printf("It looks like Clover is already at it's right place. Do you "
             "really want to continue? (y/n): ");
      scanf("%s", location);
      if (location[0] != 'y')
        return -1;
      system("mkdir /tmp/efi_hdd/EFI/");
    }
    if (system("cp -a /tmp/efi_usb/EFI/ /tmp/efi_hdd/EFI/") != 0)
      return show_error("Copying CLOVER failed!");
    system("diskutil unmount /tmp/efi_usb && diskutil unmount /tmp/efi_hdd && "
           "rmdir /tmp/efi_usb /tmp/efi_hdd");
    break;
  default:
    return show_error("Invalid Argument(s).");
  }
  printf("Done.\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<recovery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffc3,%eax
mov    %eax,%ecx
mov    %rcx,-0x1d0(%rbp)
sub    $0x8,%eax
ja     174d <recovery+0x5bd>
mov    -0x1d0(%rbp),%rax
lea    0xe38(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rsi
mov    $0x2a,%edi
call   1060 <kext_admin@plt>
jmp    1761 <recovery+0x5d1>
lea    0xe39(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1c2(%rbp),%rsi
lea    0x114d(%rip),%rdi
call   1070 <scanf@plt>
movsbl -0x1c2(%rbp),%eax
cmp    $0x79,%eax
jne    1230 <recovery+0xa0>
lea    0xe37(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4c(%rip),%rdi
call   1040 <system@plt>
jmp    1244 <recovery+0xb4>
lea    0xe98(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
lea    0xeda(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1c2(%rbp),%rsi
lea    0x10ed(%rip),%rdi
call   1070 <scanf@plt>
movsbl -0x1c2(%rbp),%eax
cmp    $0x79,%eax
jne    1284 <recovery+0xf4>
lea    0xed5(%rip),%rdi
call   1040 <system@plt>
jmp    1290 <recovery+0x100>
lea    0xee9(%rip),%rdi
call   1050 <printf@plt>
jmp    1761 <recovery+0x5d1>
lea    0xef8(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     12be <recovery+0x12e>
lea    0xefb(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
jmp    12c3 <recovery+0x133>
lea    0xf3d(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     12ec <recovery+0x15c>
lea    0xf62(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
jmp    1761 <recovery+0x5d1>
lea    0xf5b(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     131a <recovery+0x18a>
lea    0xf54(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
lea    0xf72(%rip),%rdi
call   1050 <printf@plt>
lea    -0x14f(%rbp),%rsi
lea    0x1017(%rip),%rdi
call   1070 <scanf@plt>
lea    0xfae(%rip),%rdi
call   1040 <system@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xfab(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xf9f(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
mov    0x2c38(%rip),%rax
mov    (%rax),%esi
lea    0xfad(%rip),%rdi
call   1090 <access@plt>
cmp    $0x0,%eax
jne    13c7 <recovery+0x237>
lea    -0x1c0(%rbp),%rdi
lea    0xf91(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13da <recovery+0x24a>
lea    -0x1c0(%rbp),%rdi
lea    0xf82(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xf80(%rip),%rdi
call   1050 <printf@plt>
mov    0x2be3(%rip),%rax
mov    (%rax),%esi
lea    0xf87(%rip),%rdi
call   1090 <access@plt>
cmp    $0x0,%eax
jne    142a <recovery+0x29a>
lea    -0x140(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
lea    0xf5e(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xf57(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    0xf53(%rip),%rdi
call   1040 <system@plt>
jmp    1761 <recovery+0x5d1>
mov    -0x10(%rbp),%rdi
mov    0x2b64(%rip),%rax
mov    (%rax),%esi
call   1090 <access@plt>
cmp    $0x0,%eax
je     1506 <recovery+0x376>
lea    0xf3d(%rip),%rdi
call   1050 <printf@plt>
lea    0xf47(%rip),%rdi
call   1040 <system@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
jne    14b5 <recovery+0x325>
lea    0xf60(%rip),%rdi
call   1050 <printf@plt>
lea    0xf77(%rip),%rdi
call   1050 <printf@plt>
lea    -0x140(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xf75(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     1501 <recovery+0x371>
lea    0xf7e(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
jmp    151a <recovery+0x38a>
lea    0xf7e(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
jmp    1761 <recovery+0x5d1>
lea    0xf78(%rip),%rdi
call   1050 <printf@plt>
lea    0xf86(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     1554 <recovery+0x3c4>
lea    0xfce(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
jmp    1761 <recovery+0x5d1>
lea    0xcf3(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     1582 <recovery+0x3f2>
lea    0xcec(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
lea    0xfaa(%rip),%rdi
call   1050 <printf@plt>
lea    0x1014(%rip),%rdi
call   1050 <printf@plt>
lea    -0x14f(%rbp),%rsi
lea    0xda3(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x14f(%rbp),%rdi
lea    0x102f(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xd30(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    0x1000(%rip),%rdi
call   1040 <system@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xff9(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    0x100c(%rip),%rdi
call   1050 <printf@plt>
lea    -0x14f(%rbp),%rsi
lea    0xd19(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x14f(%rbp),%rdi
lea    0xfa5(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xca6(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    0xff2(%rip),%rdi
call   1040 <system@plt>
lea    -0x140(%rbp),%rdi
lea    -0x14f(%rbp),%rdx
lea    0xfeb(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x140(%rbp),%rdi
call   1040 <system@plt>
lea    0xffe(%rip),%rdi
call   1050 <printf@plt>
mov    0x291b(%rip),%rax
mov    (%rax),%esi
lea    0xffc(%rip),%rdi
call   1090 <access@plt>
cmp    $0x0,%eax
jne    1713 <recovery+0x583>
lea    0xfff(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1c0(%rbp),%rsi
lea    0xc65(%rip),%rdi
call   1070 <scanf@plt>
movsbl -0x1c0(%rbp),%eax
cmp    $0x79,%eax
je     1707 <recovery+0x577>
movl   $0xffffffff,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
lea    0x1021(%rip),%rdi
call   1040 <system@plt>
lea    0x102d(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%eax
je     173c <recovery+0x5ac>
lea    0x1042(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
lea    0x1045(%rip),%rdi
call   1040 <system@plt>
jmp    1761 <recovery+0x5d1>
lea    0x1096(%rip),%rdi
call   1080 <show_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1779 <recovery+0x5e9>
lea    0x1097(%rip),%rdi
call   1050 <printf@plt>
mov    0x286c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recovery>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b0,%rsp
add    $0xffffffc3,%edi
cmp    $0x8,%edi
ja     137c <recovery+0x1dc>
mov    %rsi,%rbx
lea    0xe3a(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x103c(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
jne    1458 <recovery+0x2b8>
lea    0x14cd(%rip),%rdi
call   1040 <puts@plt>
lea    0x127e(%rip),%rdi
call   1060 <printf@plt>
lea    0x1108(%rip),%r15
lea    0x1(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
lea    0x129c(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   10b0 <strcat@plt>
lea    0x1099(%rip),%r13
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0x1268(%rip),%rdi
call   1050 <system@plt>
lea    0x126f(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0x1280(%rip),%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0x1286(%rip),%rdi
call   1050 <system@plt>
lea    0x128d(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0x1458(%rip),%rdi
call   1040 <puts@plt>
mov    0x2cf0(%rip),%rax
mov    (%rax),%esi
lea    0x1289(%rip),%rdi
call   10a0 <access@plt>
test   %eax,%eax
jne    132b <recovery+0x18b>
lea    0x1291(%rip),%rdi
call   1060 <printf@plt>
lea    0x1005(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    $0xffffffff,%eax
cmpb   $0x79,0x10(%rsp)
jne    166a <recovery+0x4ca>
lea    0x12c1(%rip),%rdi
call   1050 <system@plt>
lea    0x12cd(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     1649 <recovery+0x4a9>
lea    0x12e3(%rip),%rdi
call   1090 <show_error@plt>
jmp    166a <recovery+0x4ca>
lea    0x13ed(%rip),%rdi
call   1040 <puts@plt>
lea    0x1096(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     1655 <recovery+0x4b5>
lea    0x10df(%rip),%rdi
jmp    1626 <recovery+0x486>
lea    0x131f(%rip),%rdi
jmp    1626 <recovery+0x486>
lea    0xc95(%rip),%rdi
call   1060 <printf@plt>
lea    0xf6f(%rip),%rdi
lea    0x80(%rsp),%rsi
call   1080 <scanf@plt>
cmpb   $0x79,0x80(%rsp)
79
jne    1506 <recovery+0x366>
lea    0x1400(%rip),%rdi
call   1040 <puts@plt>
lea    0xc88(%rip),%rdi
call   1050 <system@plt>
lea    0xd2f(%rip),%rdi
call   1060 <printf@plt>
lea    0xf29(%rip),%rdi
lea    0x80(%rsp),%rsi
call   1080 <scanf@plt>
cmpb   $0x79,0x80(%rsp)
79
jne    163b <recovery+0x49b>
lea    0xd2b(%rip),%rdi
jmp    1650 <recovery+0x4b0>
lea    0xd44(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     1424 <recovery+0x284>
lea    0xd4c(%rip),%rdi
jmp    1626 <recovery+0x486>
lea    0xd9b(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     1655 <recovery+0x4b5>
lea    0xdc1(%rip),%rdi
jmp    1626 <recovery+0x486>
lea    0xdc7(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     1517 <recovery+0x377>
lea    0xdc1(%rip),%rdi
jmp    1626 <recovery+0x486>
mov    $0x2a,%edi
mov    %rbx,%rsi
call   1070 <kext_admin@plt>
jmp    1655 <recovery+0x4b5>
mov    0x2b53(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10a0 <access@plt>
test   %eax,%eax
je     161f <recovery+0x47f>
lea    0x12c7(%rip),%rdi
call   1040 <puts@plt>
lea    0xec7(%rip),%rdi
call   1050 <system@plt>
lea    0x80(%rsp),%rdi
call   1050 <system@plt>
test   %eax,%eax
jne    14c4 <recovery+0x324>
lea    0x12c7(%rip),%rdi
call   1040 <puts@plt>
lea    0x12a7(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rsi
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   10c0 <sprintf@plt>
mov    %r14,%rdi
call   1050 <system@plt>
test   %eax,%eax
je     1655 <recovery+0x4b5>
lea    0xecc(%rip),%rdi
jmp    1626 <recovery+0x486>
lea    0xba1(%rip),%rdi
call   1090 <show_error@plt>
jmp    166a <recovery+0x4ca>
lea    0xd34(%rip),%rdi
call   1060 <printf@plt>
lea    0xde0(%rip),%rdi
lea    0x1(%rsp),%r14
mov    %r14,%rsi
call   1080 <scanf@plt>
lea    0xd6f(%rip),%rdi
call   1050 <system@plt>
lea    0xd7a(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0xd72(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
mov    0x2a4a(%rip),%r14
mov    (%r14),%esi
lea    0xd7d(%rip),%rbx
mov    %rbx,%rdi
call   10a0 <access@plt>
test   %eax,%eax
lea    0xd75(%rip),%rsi
cmove  %rbx,%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0x11f2(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%esi
lea    0xd61(%rip),%rdi
call   10a0 <access@plt>
test   %eax,%eax
jne    15f2 <recovery+0x452>
lea    0xd4b(%rip),%rsi
lea    0x80(%rsp),%rbx
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0xd46(%rip),%rsi
lea    0x80(%rsp),%rbx
lea    0x1(%rsp),%rdx
mov    %rbx,%rdi
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
lea    0xd36(%rip),%rdi
jmp    1650 <recovery+0x4b0>
lea    0xdc0(%rip),%rdi
add    $0x1b0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1090 <show_error@plt>
lea    0x119b(%rip),%rdi
call   1040 <puts@plt>
jmp    1655 <recovery+0x4b5>
lea    0xff0(%rip),%rdi
call   1050 <system@plt>
lea    0x10e2(%rip),%rdi
call   1040 <puts@plt>
mov    0x2978(%rip),%rax
mov    (%rax),%eax
add    $0x1b0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Do you have a working Ethernet/Wifi? (y/n): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [33 x i8] c"Reseting network preferences...\0A\00"
@.str.3 = [93 x i8] c"cd /Library/Preferences/SystemConfiguration/ && rm NetworkInterfaces.plist preferences.plist\00"
@.str.4 = [86 x i8] c"You need to use Null Ethernet Network. Visit http://bit.ly/null-ethernet for details.\00"
@.str.5 = [42 x i8] c"Done.\0ADo you want to restart now? (y/n): \00"
@.str.6 = [37 x i8] c"sudo shutdown -r now \22Restarting...\22\00"
@.str.7 = [32 x i8] c"You choose not to restart now.\0A\00"
@.str.8 = [24 x i8] c"fsck -fy && mount -uw /\00"
@.str.9 = [91 x i8] c"Init failed! This usually occurs because of the user being not logged in single user mode.\00"
@.str.10 = [58 x i8] c"sudo touch /S*/L*/Extensions && sudo kextcache -Boot -U /\00"
@.str.11 = [18 x i8] c"Operation failed!\00"
@.str.12 = [14 x i8] c"diskutil list\00"
@.str.13 = [50 x i8] c"You cannot do this operation in single user mode!\00"
@.str.14 = [91 x i8] c"Enter the \1B[1;30mIDENTIFIER\1B[0m of the USB partition to install machelper (e.g. disk1s2): \00"
@.str.15 = [23 x i8] c"mkdir /tmp/usb_helper/\00"
@.str.16 = [26 x i8] c"diskutil unmount force %s\00"
@.str.17 = [47 x i8] c"diskutil mount -mountPoint /tmp/usb_helper/ %s\00"
@.str.18 = [19 x i8] c"/usr/bin/machelper\00"
@F_OK = global i32 0
@.str.19 = [10 x i8] c"machelper\00"
@.str.20 = [22 x i8] c"Copying machelper...\0A\00"
@.str.21 = [25 x i8] c"/tmp/usb_helper/usr/bin/\00"
@.str.22 = [31 x i8] c"cp %s /tmp/usb_helper/usr/bin/\00"
@.str.23 = [20 x i8] c"diskutil unmount %s\00"
@.str.24 = [22 x i8] c"rmdir /tmp/usb_helper\00"
@.str.25 = [22 x i8] c"Backing up kernel...\0A\00"
@.str.26 = [58 x i8] c"cp /System/Library/Kernels/kernel ~/Desktop/kernel_backup\00"
@.str.27 = [35 x i8] c"Kernel is backed up at ~/Desktop/\0A\00"
@.str.28 = [21 x i8] c"Replacing kernel...\0A\00"
@.str.29 = [42 x i8] c"sudo cp %s /System/Library/Kernels/kernel\00"
@.str.30 = [25 x i8] c"Replacing kernel failed!\00"
@.str.31 = [19 x i8] c"Unresolved source.\00"
@.str.32 = [26 x i8] c"Disabling Hibernation...\0A\00"
@.str.33 = [93 x i8] c"sudo pmset -a hibernatemode 0 && sudo rm /var/vm/sleepimage && sudo mkdir /var/vm/sleepimage\00"
@.str.34 = [30 x i8] c"Disabling hibernation failed!\00"
@.str.35 = [118 x i8] c"\1B[4mBe careful with this options\1B[0m, as choosing wrong value(s) may cause important data to be wiped not knowingly.\0A\00"
@.str.36 = [65 x i8] c"Enter the \1B[1;30mIDENTIFIER\1B[0m of the USB device (e.g. disk1): \00"
@.str.37 = [3 x i8] c"s1\00"
@.str.38 = [19 x i8] c"mkdir /tmp/efi_usb\00"
@.str.39 = [43 x i8] c"diskutil mount -mountPoint /tmp/efi_usb %s\00"
@.str.40 = [62 x i8] c"Enter the \1B[1;30mIDENTIFIER\1B[0m of the HDD/SSD (e.g. disk0): \00"
@.str.41 = [19 x i8] c"mkdir /tmp/efi_hdd\00"
@.str.42 = [43 x i8] c"diskutil mount -mountPoint /tmp/efi_hdd %s\00"
@.str.43 = [19 x i8] c"Copying Clover...\0A\00"
@.str.44 = [24 x i8] c"/tmp/efi_hdd/EFI/CLOVER\00"
@.str.45 = [93 x i8] c"It looks like Clover is already at it's right place. Do you really want to continue? (y/n): \00"
@.str.46 = [24 x i8] c"mkdir /tmp/efi_hdd/EFI/\00"
@.str.47 = [42 x i8] c"cp -a /tmp/efi_usb/EFI/ /tmp/efi_hdd/EFI/\00"
@.str.48 = [23 x i8] c"Copying CLOVER failed!\00"
@.str.49 = [98 x i8] c"diskutil unmount /tmp/efi_usb && diskutil unmount /tmp/efi_hdd && rmdir /tmp/efi_usb /tmp/efi_hdd\00"
@.str.50 = [21 x i8] c"Invalid Argument(s).\00"
@.str.51 = [7 x i8] c"Done.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @recovery(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [300 x i8]
%7 = alloca [15 x i8]
%8 = alloca [100 x i8]
%9 = alloca [2 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
%10 = load i32, i32* %4
switch i32 %10, label %194 [
i32 68, label %11
i32 64, label %14
i32 65, label %40
i32 67, label %46
i32 66, label %52
i32 69, label %99
i32 62, label %126
i32 61, label %133
]
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = call i32 @kext_admin(i32 42, i8* %12)
br label %196
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 121
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @system(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.3, i64 0, i64 0))
br label %27
25: ; preds = %14
%26 = call i32 @show_error(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0))
store i32 %26, i32* %3
br label %199
27: ; preds = %22
%28 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 121
br i1 %34, label %35, label %37
35: ; preds = %27
%36 = call i32 @system(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
br label %39
37: ; preds = %27
%38 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
br label %196
40: ; preds = %2
%41 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @show_error(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.9, i64 0, i64 0))
store i32 %44, i32* %3
br label %199
45: ; preds = %40
br label %46
46: ; preds = %2, %45
%47 = call i32 @system(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @show_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
store i32 %50, i32* %3
br label %199
51: ; preds = %46
br label %196
52: ; preds = %2
%53 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
store i32 %56, i32* %3
br label %199
57: ; preds = %52
%58 = call i32 @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.14, i64 0, i64 0))
%59 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %59)
%61 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
%62 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%63 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%64 = call i32 @sprintf(i8* %62, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %63)
%65 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%66 = call i32 @system(i8* %65)
%67 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%68 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%69 = call i32 @sprintf(i8* %67, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.17, i64 0, i64 0), i8* %68)
%70 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%71 = call i32 @system(i8* %70)
%72 = load i32, i32* @F_OK
%73 = call i32 @access(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i32 %72)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %57
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%77 = call i32 @strcpy(i8* %76, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %81
78: ; preds = %57
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%80 = call i32 @strcpy(i8* %79, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0))
br label %81
81: ; preds = %78, %75
%82 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0))
%83 = load i32, i32* @F_OK
%84 = call i32 @access(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0), i32 %83)
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %81
%87 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%88 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%89 = call i32 @sprintf(i8* %87, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.22, i64 0, i64 0), i8* %88)
%90 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%91 = call i32 @system(i8* %90)
br label %92
92: ; preds = %86, %81
%93 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%94 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%95 = call i32 @sprintf(i8* %93, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i64 0, i64 0), i8* %94)
%96 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%97 = call i32 @system(i8* %96)
%98 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.24, i64 0, i64 0))
br label %196
99: ; preds = %2
%100 = load i8*, i8** %5
%101 = load i32, i32* @F_OK
%102 = call i32 @access(i8* %100, i32 %101)
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %123
104: ; preds = %99
%105 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.25, i64 0, i64 0))
%106 = call i32 @system(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.26, i64 0, i64 0))
%107 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%108 = call i32 @system(i8* %107)
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %104
%111 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.27, i64 0, i64 0))
br label %112
112: ; preds = %110, %104
%113 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.28, i64 0, i64 0))
%114 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%115 = load i8*, i8** %5
%116 = call i32 @sprintf(i8* %114, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.29, i64 0, i64 0), i8* %115)
%117 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%118 = call i32 @system(i8* %117)
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %112
%121 = call i32 @show_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.30, i64 0, i64 0))
store i32 %121, i32* %3
br label %199
122: ; preds = %112
br label %125
123: ; preds = %99
%124 = call i32 @show_error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.31, i64 0, i64 0))
store i32 %124, i32* %3
br label %199
125: ; preds = %122
br label %196
126: ; preds = %2
%127 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.32, i64 0, i64 0))
%128 = call i32 @system(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.33, i64 0, i64 0))
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %132
130: ; preds = %126
%131 = call i32 @show_error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.34, i64 0, i64 0))
store i32 %131, i32* %3
br label %199
132: ; preds = %126
br label %196
133: ; preds = %2
%134 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%135 = icmp ne i32 %134, 0
br i1 %135, label %136, label %138
136: ; preds = %133
%137 = call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
store i32 %137, i32* %3
br label %199
138: ; preds = %133
%139 = call i32 @printf(i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str.35, i64 0, i64 0))
%140 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.36, i64 0, i64 0))
%141 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%142 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %141)
%143 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%144 = call i32 @strcat(i8* %143, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%145 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%146 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%147 = call i32 @sprintf(i8* %145, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %146)
%148 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%149 = call i32 @system(i8* %148)
%150 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.38, i64 0, i64 0))
%151 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%152 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%153 = call i32 @sprintf(i8* %151, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.39, i64 0, i64 0), i8* %152)
%154 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%155 = call i32 @system(i8* %154)
%156 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.40, i64 0, i64 0))
%157 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%158 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %157)
%159 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%160 = call i32 @strcat(i8* %159, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%161 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%162 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%163 = call i32 @sprintf(i8* %161, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %162)
%164 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%165 = call i32 @system(i8* %164)
%166 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.41, i64 0, i64 0))
%167 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%168 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%169 = call i32 @sprintf(i8* %167, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.42, i64 0, i64 0), i8* %168)
%170 = getelementptr inbounds [300 x i8], [300 x i8]* %6, i64 0, i64 0
%171 = call i32 @system(i8* %170)
%172 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.43, i64 0, i64 0))
%173 = load i32, i32* @F_OK
%174 = call i32 @access(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.44, i64 0, i64 0), i32 %173)
%175 = icmp eq i32 %174, 0
br i1 %175, label %176, label %187
176: ; preds = %138
%177 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.45, i64 0, i64 0))
%178 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%179 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %178)
%180 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%181 = load i8, i8* %180
%182 = sext i8 %181 to i32
%183 = icmp ne i32 %182, 121
br i1 %183, label %184, label %185
184: ; preds = %176
store i32 -1, i32* %3
br label %199
185: ; preds = %176
%186 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.46, i64 0, i64 0))
br label %187
187: ; preds = %185, %138
%188 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.47, i64 0, i64 0))
%189 = icmp ne i32 %188, 0
br i1 %189, label %190, label %192
190: ; preds = %187
%191 = call i32 @show_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.48, i64 0, i64 0))
store i32 %191, i32* %3
br label %199
192: ; preds = %187
%193 = call i32 @system(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.49, i64 0, i64 0))
br label %196
194: ; preds = %2
%195 = call i32 @show_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.50, i64 0, i64 0))
store i32 %195, i32* %3
br label %199
196: ; preds = %192, %132, %125, %92, %51, %39, %11
%197 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.51, i64 0, i64 0))
%198 = load i32, i32* @EXIT_SUCCESS
store i32 %198, i32* %3
br label %199
199: ; preds = %196, %194, %190, %184, %136, %130, %123, %120, %55, %49, %43, %25
%200 = load i32, i32* %3
ret i32 %200
}

LLVM IR (-O2):
@.str = [45 x i8] c"Do you have a working Ethernet/Wifi? (y/n): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [93 x i8] c"cd /Library/Preferences/SystemConfiguration/ && rm NetworkInterfaces.plist preferences.plist\00"
@.str.4 = [86 x i8] c"You need to use Null Ethernet Network. Visit http://bit.ly/null-ethernet for details.\00"
@.str.5 = [42 x i8] c"Done.\0ADo you want to restart now? (y/n): \00"
@.str.6 = [37 x i8] c"sudo shutdown -r now \22Restarting...\22\00"
@.str.8 = [24 x i8] c"fsck -fy && mount -uw /\00"
@.str.9 = [91 x i8] c"Init failed! This usually occurs because of the user being not logged in single user mode.\00"
@.str.10 = [58 x i8] c"sudo touch /S*/L*/Extensions && sudo kextcache -Boot -U /\00"
@.str.11 = [18 x i8] c"Operation failed!\00"
@.str.12 = [14 x i8] c"diskutil list\00"
@.str.13 = [50 x i8] c"You cannot do this operation in single user mode!\00"
@.str.14 = [91 x i8] c"Enter the \1B[1;30mIDENTIFIER\1B[0m of the USB partition to install machelper (e.g. disk1s2): \00"
@.str.15 = [23 x i8] c"mkdir /tmp/usb_helper/\00"
@.str.16 = [26 x i8] c"diskutil unmount force %s\00"
@.str.17 = [47 x i8] c"diskutil mount -mountPoint /tmp/usb_helper/ %s\00"
@.str.18 = [19 x i8] c"/usr/bin/machelper\00"
@F_OK = global i32 0
@.str.19 = [10 x i8] c"machelper\00"
@.str.21 = [25 x i8] c"/tmp/usb_helper/usr/bin/\00"
@.str.22 = [31 x i8] c"cp %s /tmp/usb_helper/usr/bin/\00"
@.str.23 = [20 x i8] c"diskutil unmount %s\00"
@.str.24 = [22 x i8] c"rmdir /tmp/usb_helper\00"
@.str.26 = [58 x i8] c"cp /System/Library/Kernels/kernel ~/Desktop/kernel_backup\00"
@.str.29 = [42 x i8] c"sudo cp %s /System/Library/Kernels/kernel\00"
@.str.30 = [25 x i8] c"Replacing kernel failed!\00"
@.str.31 = [19 x i8] c"Unresolved source.\00"
@.str.33 = [93 x i8] c"sudo pmset -a hibernatemode 0 && sudo rm /var/vm/sleepimage && sudo mkdir /var/vm/sleepimage\00"
@.str.34 = [30 x i8] c"Disabling hibernation failed!\00"
@.str.36 = [65 x i8] c"Enter the \1B[1;30mIDENTIFIER\1B[0m of the USB device (e.g. disk1): \00"
@.str.37 = [3 x i8] c"s1\00"
@.str.38 = [19 x i8] c"mkdir /tmp/efi_usb\00"
@.str.39 = [43 x i8] c"diskutil mount -mountPoint /tmp/efi_usb %s\00"
@.str.40 = [62 x i8] c"Enter the \1B[1;30mIDENTIFIER\1B[0m of the HDD/SSD (e.g. disk0): \00"
@.str.41 = [19 x i8] c"mkdir /tmp/efi_hdd\00"
@.str.42 = [43 x i8] c"diskutil mount -mountPoint /tmp/efi_hdd %s\00"
@.str.44 = [24 x i8] c"/tmp/efi_hdd/EFI/CLOVER\00"
@.str.45 = [93 x i8] c"It looks like Clover is already at it's right place. Do you really want to continue? (y/n): \00"
@.str.46 = [24 x i8] c"mkdir /tmp/efi_hdd/EFI/\00"
@.str.47 = [42 x i8] c"cp -a /tmp/efi_usb/EFI/ /tmp/efi_hdd/EFI/\00"
@.str.48 = [23 x i8] c"Copying CLOVER failed!\00"
@.str.49 = [98 x i8] c"diskutil unmount /tmp/efi_usb && diskutil unmount /tmp/efi_hdd && rmdir /tmp/efi_usb /tmp/efi_hdd\00"
@.str.50 = [21 x i8] c"Invalid Argument(s).\00"
@EXIT_SUCCESS = global i32 0
@str = [117 x i8] c"\1B[4mBe careful with this options\1B[0m, as choosing wrong value(s) may cause important data to be wiped not knowingly.\00"
@str.52 = [18 x i8] c"Copying Clover...\00"
@str.53 = [6 x i8] c"Done.\00"
@str.54 = [25 x i8] c"Disabling Hibernation...\00"
@str.55 = [21 x i8] c"Backing up kernel...\00"
@str.56 = [20 x i8] c"Replacing kernel...\00"
@str.57 = [34 x i8] c"Kernel is backed up at ~/Desktop/\00"
@str.58 = [21 x i8] c"Copying machelper...\00"
@str.59 = [32 x i8] c"Reseting network preferences...\00"
@str.60 = [31 x i8] c"You choose not to restart now.\00"
define i32 @recovery(i32 %0, i8* %1) {
%3 = alloca [300 x i8]
%4 = alloca [15 x i8]
%5 = alloca [100 x i8]
%6 = alloca [2 x i8]
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
switch i32 %0, label %137 [
i32 68, label %11
i32 64, label %13
i32 65, label %31
i32 67, label %36
i32 66, label %41
i32 69, label %70
i32 62, label %90
i32 61, label %96
]
11: ; preds = %2
%12 = tail call i32 @kext_admin(i32 42, i8* %1)
br label %139
13: ; preds = %2
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%16 = load i8, i8* %10
%17 = icmp eq i8 %16, 121
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.59, i64 0, i64 0))
%20 = call i32 @system(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%23 = load i8, i8* %10
%24 = icmp eq i8 %23, 121
br i1 %24, label %27, label %29
25: ; preds = %13
%26 = call i32 @show_error(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0))
br label %142
27: ; preds = %18
%28 = call i32 @system(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
br label %139
29: ; preds = %18
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.60, i64 0, i64 0))
br label %139
31: ; preds = %2
%32 = tail call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = tail call i32 @show_error(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.9, i64 0, i64 0))
br label %142
36: ; preds = %31, %2
%37 = tail call i32 @system(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
br i1 %38, label %139, label %39
39: ; preds = %36
%40 = tail call i32 @show_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
br label %142
41: ; preds = %2
%42 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = tail call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
br label %142
46: ; preds = %41
%47 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @.str.14, i64 0, i64 0))
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%49 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
%50 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %8)
%51 = call i32 @system(i8* %7)
%52 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.17, i64 0, i64 0), i8* %8)
%53 = call i32 @system(i8* %7)
%54 = load i32, i32* @F_OK
%55 = call i32 @access(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i32 %54)
%56 = icmp eq i32 %55, 0
%57 = select i1 %56, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0)
%58 = call i32 @strcpy(i8* %9, i8* %57)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.58, i64 0, i64 0))
%60 = load i32, i32* @F_OK
%61 = call i32 @access(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0), i32 %60)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %46
%64 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.22, i64 0, i64 0), i8* %9)
%65 = call i32 @system(i8* %7)
br label %66
66: ; preds = %63, %46
%67 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i64 0, i64 0), i8* %8)
%68 = call i32 @system(i8* %7)
%69 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.24, i64 0, i64 0))
br label %139
70: ; preds = %2
%71 = load i32, i32* @F_OK
%72 = tail call i32 @access(i8* %1, i32 %71)
%73 = icmp eq i32 %72, 0
br i1 %73, label %88, label %74
74: ; preds = %70
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.55, i64 0, i64 0))
%76 = tail call i32 @system(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.26, i64 0, i64 0))
%77 = call i32 @system(i8* %7)
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.57, i64 0, i64 0))
br label %81
81: ; preds = %79, %74
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.56, i64 0, i64 0))
%83 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.29, i64 0, i64 0), i8* %1)
%84 = call i32 @system(i8* %7)
%85 = icmp eq i32 %84, 0
br i1 %85, label %139, label %86
86: ; preds = %81
%87 = tail call i32 @show_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.30, i64 0, i64 0))
br label %142
88: ; preds = %70
%89 = tail call i32 @show_error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.31, i64 0, i64 0))
br label %142
90: ; preds = %2
%91 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.54, i64 0, i64 0))
%92 = tail call i32 @system(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.33, i64 0, i64 0))
%93 = icmp eq i32 %92, 0
br i1 %93, label %139, label %94
94: ; preds = %90
%95 = tail call i32 @show_error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.34, i64 0, i64 0))
br label %142
96: ; preds = %2
%97 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%98 = icmp eq i32 %97, 0
br i1 %98, label %101, label %99
99: ; preds = %96
%100 = tail call i32 @show_error(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
br label %142
101: ; preds = %96
%102 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([117 x i8], [117 x i8]* @str, i64 0, i64 0))
%103 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.36, i64 0, i64 0))
%104 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%105 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%106 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %8)
%107 = call i32 @system(i8* %7)
%108 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.38, i64 0, i64 0))
%109 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.39, i64 0, i64 0), i8* %8)
%110 = call i32 @system(i8* %7)
%111 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.40, i64 0, i64 0))
%112 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%113 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%114 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %8)
%115 = call i32 @system(i8* %7)
%116 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.41, i64 0, i64 0))
%117 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.42, i64 0, i64 0), i8* %8)
%118 = call i32 @system(i8* %7)
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.52, i64 0, i64 0))
%120 = load i32, i32* @F_OK
%121 = call i32 @access(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.44, i64 0, i64 0), i32 %120)
%122 = icmp eq i32 %121, 0
br i1 %122, label %123, label %130
123: ; preds = %101
%124 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @.str.45, i64 0, i64 0))
%125 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%126 = load i8, i8* %9
%127 = icmp eq i8 %126, 121
br i1 %127, label %128, label %142
128: ; preds = %123
%129 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.46, i64 0, i64 0))
br label %130
130: ; preds = %128, %101
%131 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.47, i64 0, i64 0))
%132 = icmp eq i32 %131, 0
br i1 %132, label %135, label %133
133: ; preds = %130
%134 = call i32 @show_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.48, i64 0, i64 0))
br label %142
135: ; preds = %130
%136 = call i32 @system(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.49, i64 0, i64 0))
br label %139
137: ; preds = %2
%138 = tail call i32 @show_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.50, i64 0, i64 0))
br label %142
139: ; preds = %90, %81, %36, %27, %29, %135, %66, %11
%140 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.53, i64 0, i64 0))
%141 = load i32, i32* @EXIT_SUCCESS
br label %142
142: ; preds = %123, %139, %137, %133, %99, %94, %88, %86, %44, %39, %34, %25
%143 = phi i32 [ %138, %137 ], [ %100, %99 ], [ %134, %133 ], [ %141, %139 ], [ %95, %94 ], [ %87, %86 ], [ %89, %88 ], [ %45, %44 ], [ %40, %39 ], [ %35, %34 ], [ %26, %25 ], [ -1, %123 ]
ret i32 %143
}