#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ errno;
int /*<<< orphan*/ perror(char *);
int stat(char *, struct stat *);
int system(char *);
int make_key() {
  int rc;
  struct stat st;
  rc = stat("/home/bticino/cfg/extra"
            "/startssh_rsa_key",
            &st);
  if ((rc == -1) && (errno == ENOENT)) {
    rc = system("/usr/sbin/dropbearkey"
                " -t rsa -f "
                "/home/bticino/cfg/extra"
                "/startssh_rsa_key");
    if (rc == -1)
      perror("system "
             "/usr/sbin/dropbearkey");
  } else if (rc == -1) {
    perror("stat "
           "/home/bticino/cfg/extra"
           "/startssh_rsa_key");
  }
  return rc;
}


x86 assembly (clang, -O0):
<make_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1199 <make_key+0x69>
mov    0x2e84(%rip),%rax
mov    (%rax),%rax
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%rax
jne    1199 <make_key+0x69>
lea    0xe8a(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1194 <make_key+0x64>
lea    0xeba(%rip),%rdi
call   1050 <perror@plt>
jmp    11b4 <make_key+0x84>
cmpl   $0xffffffff,-0x4(%rbp)
jne    11af <make_key+0x7f>
lea    0xebc(%rip),%rdi
call   1050 <perror@plt>
jmp    11b4 <make_key+0x84>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_key>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     1147 <make_key+0x17>
pop    %rcx
ret
mov    0x2e92(%rip),%rax
mov    (%rax),%rax
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%rax
jne    1177 <make_key+0x47>
lea    0xe9c(%rip),%rdi
call   1030 <system@plt>
cmp    $0xffffffff,%eax
jne    1145 <make_key+0x15>
lea    0xed4(%rip),%rdi
jmp    117e <make_key+0x4e>
lea    0xee8(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [41 x i8] c"/home/bticino/cfg/extra/startssh_rsa_key\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.1 = [73 x i8] c"/usr/sbin/dropbearkey -t rsa -f /home/bticino/cfg/extra/startssh_rsa_key\00"
@.str.2 = [29 x i8] c"system /usr/sbin/dropbearkey\00"
@.str.3 = [46 x i8] c"stat /home/bticino/cfg/extra/startssh_rsa_key\00"
define i32 @make_key() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = call i32 @stat(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %17
6: ; preds = %0
%7 = load i64, i64* @errno
%8 = load i64, i64* @ENOENT
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = call i32 @system(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
br label %23
17: ; preds = %6, %0
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
br label %23
23: ; preds = %22, %16
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [41 x i8] c"/home/bticino/cfg/extra/startssh_rsa_key\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.1 = [73 x i8] c"/usr/sbin/dropbearkey -t rsa -f /home/bticino/cfg/extra/startssh_rsa_key\00"
@.str.2 = [29 x i8] c"system /usr/sbin/dropbearkey\00"
@.str.3 = [46 x i8] c"stat /home/bticino/cfg/extra/startssh_rsa_key\00"
define i32 @make_key() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @stat(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %15
5: ; preds = %0
%6 = load i64, i64* @errno
%7 = load i64, i64* @ENOENT
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = tail call i32 @system(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %5, %9
%13 = phi i8* [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), %5 ]
%14 = tail call i32 @perror(i8* %13)
br label %15
15: ; preds = %12, %0, %9
%16 = phi i32 [ %10, %9 ], [ %3, %0 ], [ -1, %12 ]
ret i32 %16
}