#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*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strlen(char *);
int system(char *);
int carmen_commander_accepts_pkauth(char *host) {
  char cmd[450 + strlen(host)];
  int retval;
  sprintf(cmd,
          "/bin/sh -c \" ssh -o \"KbdInteractiveDevices=none\" "
          "-o \"HostbasedAuthentication=no\" "
          "-o \"PasswordAuthentication=no\"  "
          "-o \"PubkeyAuthentication=yes\" %s 'exit 0' &> /dev/null \" ",
          host);
  retval = system(cmd);
  sprintf(cmd, "%d", retval);
  return (retval == 0);
}


x86 assembly (clang, -O0):
<carmen_commander_accepts_pkauth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1c2,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <system@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
lea    0xf12(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
cmpl   $0x0,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_commander_accepts_pkauth>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1c2,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %eax,%r14d
lea    0xf30(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
xor    %eax,%eax
test   %r14d,%r14d
sete   %al
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [171 x i8] c"/bin/sh -c \22 ssh -o \22KbdInteractiveDevices=none\22 -o \22HostbasedAuthentication=no\22 -o \22PasswordAuthentication=no\22 -o \22PubkeyAuthentication=yes\22 %s 'exit 0' &> /dev/null \22 \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @carmen_commander_accepts_pkauth(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 450, %7
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i8, i64 %9
store i64 %9, i64* %4
%12 = load i8*, i8** %2
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @system(i8* %11)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = load i8*, i8** %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [171 x i8] c"/bin/sh -c \22 ssh -o \22KbdInteractiveDevices=none\22 -o \22HostbasedAuthentication=no\22 -o \22PasswordAuthentication=no\22 -o \22PubkeyAuthentication=yes\22 %s 'exit 0' &> /dev/null \22 \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @carmen_commander_accepts_pkauth(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 450
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = call i32 @system(i8* %5)
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = icmp eq i32 %7, 0
%10 = zext i1 %9 to i32
ret i32 %10
}