#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 */
char *getenv(char *);
int /*<<< orphan*/ main();
int /*<<< orphan*/ mkdir(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ system(char *);
int client(void) {
  char charHostName[100], command[1000], sCommandFile[1000], charPath[1000];
  char *charUsername, charPathFolder;
  system("cls");
  printf("1");
  charUsername = getenv("USERNAME");
  printf("2");
  sprintf(charPath, "C:\\Users\\%s\\AppData\\Roaming\\.MrDjSoft\\Lan-Connector",
          charUsername);
  printf("3");
  system("net use X: /delete");
  system("cls");
  printf("Enter the Name you get from the Host!\n");
  printf("Input> ");
  scanf("%s", &charHostName);
  sprintf(sCommandFile, "echo %s>%s\\Last.txt", charHostName, charPath);
  mkdir(charPath);
  system(sCommandFile);
  system("cls");
  sprintf(command, "net use X: \\\\%s\\LAN-DRIVE", charHostName);
  system(command);
  printf("Connected!\n");
  system("pause");
  main();
}


x86 assembly (clang, -O0):
<client>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc50,%rsp
lea    0xe7e(%rip),%rdi
call   1050 <system@plt>
lea    0xe76(%rip),%rdi
call   1060 <printf@plt>
lea    0xe6c(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0xc48(%rbp)
lea    0xe62(%rip),%rdi
call   1060 <printf@plt>
lea    -0xc40(%rbp),%rdi
mov    -0xc48(%rbp),%rdx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    0xe70(%rip),%rdi
call   1060 <printf@plt>
lea    0xe66(%rip),%rdi
call   1050 <system@plt>
lea    0xe13(%rip),%rdi
call   1050 <system@plt>
lea    0xe61(%rip),%rdi
call   1060 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x850(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0xc40(%rbp),%rcx
lea    0xe59(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xc40(%rbp),%rdi
call   1040 <mkdir@plt>
lea    -0x850(%rbp),%rdi
call   1050 <system@plt>
lea    0xda7(%rip),%rdi
call   1050 <system@plt>
lea    -0x460(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0x460(%rbp),%rdi
call   1050 <system@plt>
lea    0xe30(%rip),%rdi
call   1060 <printf@plt>
lea    0xe30(%rip),%rdi
call   1050 <system@plt>
mov    $0x0,%al
call   1070 <main@plt>
mov    -0x4(%rbp),%eax
add    $0xc50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc38,%rsp
lea    0xe5b(%rip),%r14
mov    %r14,%rdi
call   1070 <system@plt>
mov    $0x31,%edi
call   1040 <putchar@plt>
lea    0xe46(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
mov    $0x32,%edi
call   1040 <putchar@plt>
lea    0xe36(%rip),%rsi
lea    0x70(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    $0x33,%edi
call   1040 <putchar@plt>
lea    0xe47(%rip),%rdi
call   1070 <system@plt>
mov    %r14,%rdi
call   1070 <system@plt>
lea    0xe85(%rip),%rdi
call   1060 <puts@plt>
lea    0xe3a(%rip),%rdi
call   1080 <printf@plt>
lea    0xe36(%rip),%rdi
mov    %rsp,%r12
mov    %r12,%rsi
call   10a0 <scanf@plt>
lea    0xe27(%rip),%rsi
lea    0x460(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %r15,%rdi
call   1050 <mkdir@plt>
mov    %rbx,%rdi
call   1070 <system@plt>
mov    %r14,%rdi
call   1070 <system@plt>
lea    0xe04(%rip),%rsi
lea    0x850(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <system@plt>
lea    0xe26(%rip),%rdi
call   1060 <puts@plt>
lea    0xdee(%rip),%rdi
call   1070 <system@plt>
xor    %eax,%eax
call   1090 <main@plt>
add    $0xc38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [9 x i8] c"USERNAME\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [52 x i8] c"C:\\Users\\%s\\AppData\\Roaming\\.MrDjSoft\\Lan-Connector\00"
@.str.5 = [2 x i8] c"3\00"
@.str.6 = [19 x i8] c"net use X: /delete\00"
@.str.7 = [39 x i8] c"Enter the Name you get from the Host!\0A\00"
@.str.8 = [8 x i8] c"Input> \00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [20 x i8] c"echo %s>%s\\Last.txt\00"
@.str.11 = [26 x i8] c"net use X: \\\\%s\\LAN-DRIVE\00"
@.str.12 = [12 x i8] c"Connected!\0A\00"
@.str.13 = [6 x i8] c"pause\00"
define i32 @client() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = alloca i8*
%7 = alloca i8
%8 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i8* %10, i8** %6
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%20 = bitcast [100 x i8]* %2 to i8**
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %20)
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%25 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %23, i8* %24)
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%27 = call i32 @mkdir(i8* %26)
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%29 = call i32 @system(i8* %28)
%30 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%33 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%35 = call i32 @system(i8* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%37 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%38 = call i32 (...) @main()
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.2 = [9 x i8] c"USERNAME\00"
@.str.4 = [52 x i8] c"C:\\Users\\%s\\AppData\\Roaming\\.MrDjSoft\\Lan-Connector\00"
@.str.6 = [19 x i8] c"net use X: /delete\00"
@.str.8 = [8 x i8] c"Input> \00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [20 x i8] c"echo %s>%s\\Last.txt\00"
@.str.11 = [26 x i8] c"net use X: \\\\%s\\LAN-DRIVE\00"
@.str.13 = [6 x i8] c"pause\00"
@str = [38 x i8] c"Enter the Name you get from the Host!\00"
@str.14 = [11 x i8] c"Connected!\00"
define i32 @client() {
%1 = alloca [100 x i8]
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 49)
%11 = tail call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @putchar(i32 50)
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%14 = tail call i32 @putchar(i32 51)
%15 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%16 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%19 = bitcast [100 x i8]* %1 to i8**
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %19)
%21 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %5, i8* %8)
%22 = call i32 @mkdir(i8* %8)
%23 = call i32 @system(i8* %7)
%24 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i8* %5)
%26 = call i32 @system(i8* %6)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.14, i64 0, i64 0))
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%29 = call i32 (...) @main()
ret i32 undef
}