#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*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ sleep(int);
scalar_t__ system(char *);
int main(int argc, char **argv) {
  size_t n = 0, i;
  char *user = *(argv + 1);
  char *command;
  while (*(user + n++))
    ;
  command = malloc((14 + n) * sizeof(char));
  for (i = 0; i < 14; i++)
    *(command + i) = *("setsid -c ssh " + i);
  command += 14;
  for (i = 0; i < n; i++)
    *(command + i) = *(user + i);
  command -= 14;
  if (system(command))
    sleep(3);
  free(command);
  execlp("stty", "stty", *(argv + 2), NULL);
  return 0;
  (void)argc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
cmpb   $0x0,(%rax,%rcx,1)
je     119c <main+0x4c>
jmp    117a <main+0x2a>
mov    -0x18(%rbp),%rax
add    $0xe,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0xe,-0x20(%rbp)
jae    11f0 <main+0xa0>
mov    -0x20(%rbp),%rcx
lea    0xe2f(%rip),%rax
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11bb <main+0x6b>
mov    -0x30(%rbp),%rax
add    $0xe,%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1239 <main+0xe9>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1204 <main+0xb4>
mov    -0x30(%rbp),%rax
add    $0xfffffffffffffff2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <system@plt>
cmp    $0x0,%rax
je     1262 <main+0x112>
mov    $0x3,%edi
call   1070 <sleep@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd95(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1060 <execlp@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x8(%rsi),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%r12,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1180 <main+0x20>
lea    0xe(%rbx),%edi
call   1060 <malloc@plt>
mov    %rax,%r15
movabs $0x2d20646973746573,%rax
64 20 2d
mov    %rax,(%r15)
movabs $0x2068737320632d20,%rax
73 68 20
mov    %rax,0x6(%r15)
test   %rbx,%rbx
je     11c8 <main+0x68>
mov    %r15,%rdi
add    $0xe,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <memcpy@plt>
mov    %r15,%rdi
call   1040 <system@plt>
test   %rax,%rax
je     11df <main+0x7f>
mov    $0x3,%edi
call   1080 <sleep@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x10(%r14),%rdx
lea    0xe1d(%rip),%rdi
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1070 <execlp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"setsid -c ssh \00"
@.str.1 = [5 x i8] c"stty\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %8
br label %13
13: ; preds = %20, %2
%14 = load i8*, i8** %8
%15 = load i64, i64* %6
%16 = add i64 %15, 1
store i64 %16, i64* %6
%17 = getelementptr inbounds i8, i8* %14, i64 %15
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %13
br label %13
21: ; preds = %13
%22 = load i64, i64* %6
%23 = add i64 14, %22
%24 = mul i64 %23, 1
%25 = trunc i64 %24 to i32
%26 = call i8* @malloc(i32 %25)
store i8* %26, i8** %9
store i64 0, i64* %7
br label %27
27: ; preds = %37, %21
%28 = load i64, i64* %7
%29 = icmp ult i64 %28, 14
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load i64, i64* %7
%32 = getelementptr inbounds i8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %31
%33 = load i8, i8* %32
%34 = load i8*, i8** %9
%35 = load i64, i64* %7
%36 = getelementptr inbounds i8, i8* %34, i64 %35
store i8 %33, i8* %36
br label %37
37: ; preds = %30
%38 = load i64, i64* %7
%39 = add i64 %38, 1
store i64 %39, i64* %7
br label %27
40: ; preds = %27
%41 = load i8*, i8** %9
%42 = getelementptr inbounds i8, i8* %41, i64 14
store i8* %42, i8** %9
store i64 0, i64* %7
br label %43
43: ; preds = %55, %40
%44 = load i64, i64* %7
%45 = load i64, i64* %6
%46 = icmp ult i64 %44, %45
br i1 %46, label %47, label %58
47: ; preds = %43
%48 = load i8*, i8** %8
%49 = load i64, i64* %7
%50 = getelementptr inbounds i8, i8* %48, i64 %49
%51 = load i8, i8* %50
%52 = load i8*, i8** %9
%53 = load i64, i64* %7
%54 = getelementptr inbounds i8, i8* %52, i64 %53
store i8 %51, i8* %54
br label %55
55: ; preds = %47
%56 = load i64, i64* %7
%57 = add i64 %56, 1
store i64 %57, i64* %7
br label %43
58: ; preds = %43
%59 = load i8*, i8** %9
%60 = getelementptr inbounds i8, i8* %59, i64 -14
store i8* %60, i8** %9
%61 = load i8*, i8** %9
%62 = call i64 @system(i8* %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = call i32 @sleep(i32 3)
br label %66
66: ; preds = %64, %58
%67 = load i8*, i8** %9
%68 = call i32 @free(i8* %67)
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 2
%71 = load i8*, i8** %70
%72 = call i32 @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %71, i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"setsid -c ssh \00"
@.str.1 = [5 x i8] c"stty\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
br label %5
5: ; preds = %5, %2
%6 = phi i64 [ 0, %2 ], [ %7, %5 ]
%7 = add i64 %6, 1
%8 = getelementptr inbounds i8, i8* %4, i64 %6
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = trunc i64 %6 to i32
%13 = add i32 %12, 15
%14 = tail call i8* @malloc(i32 %13)
%15 = icmp eq i64 %7, 0
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = getelementptr i8, i8* %14, i64 14
br label %18
18: ; preds = %16, %11
%19 = tail call i64 @system(i8* %14)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @sleep(i32 3)
br label %23
23: ; preds = %21, %18
%24 = tail call i32 @free(i8* %14)
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32 @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32* null)
ret i32 0
}