#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*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  FILE *fp;
  char dir[1024];
  char ssh[1024];
  fp = fopen("settings/directory.txt", "r");
  if (fp)
    fgets(dir, 1024, fp);
  fp = fopen("settings/sshkey.txt", "r");
  if (fp)
    fgets(ssh, 1024, fp);
  char *cmd =
      malloc(strlen(dir) + strlen(ssh) + strlen("ssh -t  \"python  start.py"));
  sprintf(cmd, "ssh -t %s \"python %s/start.py", ssh, dir);
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a9 <main+0x49>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    0xe69(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11e0 <main+0x80>
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x828(%rbp)
lea    -0x810(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x828(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x820(%rbp)
lea    0xe13(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x820(%rbp),%rdi
add    %rax,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rdi
lea    -0x810(%rbp),%rdx
lea    -0x410(%rbp),%rcx
lea    0xdf6(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x818(%rbp),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
lea    0xe8d(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1199 <main+0x39>
lea    0x400(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
lea    0xe79(%rip),%rdi
lea    0xe70(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11c1 <main+0x61>
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
lea    0x400(%rsp),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x19,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe37(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"settings/directory.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [20 x i8] c"settings/sshkey.txt\00"
@.str.3 = [26 x i8] c"ssh -t \22python start.py\00"
@.str.4 = [30 x i8] c"ssh -t %s \22python %s/start.py\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = load i32*, i32** %2
%12 = call i32 @fgets(i8* %10, i32 1024, i32* %11)
br label %13
13: ; preds = %9, %0
%14 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %2
%15 = load i32*, i32** %2
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%19 = load i32*, i32** %2
%20 = call i32 @fgets(i8* %18, i32 1024, i32* %19)
br label %21
21: ; preds = %17, %13
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%23 = call i64 @strlen(i8* %22)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%25 = call i64 @strlen(i8* %24)
%26 = add nsw i64 %23, %25
%27 = call i64 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%28 = add nsw i64 %26, %27
%29 = call i8* @malloc(i64 %28)
store i8* %29, i8** %5
%30 = load i8*, i8** %5
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%33 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %31, i8* %32)
%34 = load i8*, i8** %5
%35 = call i32 @system(i8* %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"settings/directory.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [20 x i8] c"settings/sshkey.txt\00"
@.str.4 = [30 x i8] c"ssh -t %s \22python %s/start.py\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @fgets(i8* %3, i32 1024, i32* %5)
br label %9
9: ; preds = %7, %0
%10 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 @fgets(i8* %4, i32 1024, i32* %10)
br label %14
14: ; preds = %12, %9
%15 = call i64 @strlen(i8* %3)
%16 = call i64 @strlen(i8* %4)
%17 = add i64 %15, 25
%18 = add i64 %17, %16
%19 = call i8* @malloc(i64 %18)
%20 = call i32 @sprintf(i8* dereferenceable(1) %19, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %4, i8* %3)
%21 = call i32 @system(i8* %19)
ret i32 0
}