#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*/ exit(int);
int /*<<< orphan*/ print_log(char *);
int /*<<< orphan*/ printf(char *);
int system(char *);
void check_for_ansible() {
  print_log("checking for ansible");
  int exit_code = system("which ansible >/dev/null 2>&1");
  if (exit_code == 256) {
    printf("I cannot find ansible on your computer.\n");
    printf("Please install ansible, then run me again.\n");
    exit(1);
  } else if (exit_code == 0) {
    print_log("-- ansible exists");
    print_log("-- moving on...");
  } else {
    printf("I could not find ansible on your computer.\n");
    printf("I got an error when I looked for it.\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_for_ansible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <print_log@plt>
lea    0xeba(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jne    1192 <check_for_ansible+0x52>
lea    0xebc(%rip),%rdi
call   1050 <printf@plt>
lea    0xed9(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11b9 <check_for_ansible+0x79>
lea    0xee5(%rip),%rdi
call   1030 <print_log@plt>
lea    0xeeb(%rip),%rdi
call   1030 <print_log@plt>
jmp    11db <check_for_ansible+0x9b>
lea    0xeea(%rip),%rdi
call   1050 <printf@plt>
lea    0xf0a(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11e0 <check_for_ansible+0xa0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_ansible>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <print_log@plt>
lea    0xec1(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
jne    1176 <check_for_ansible+0x36>
lea    0xecf(%rip),%rdi
call   1040 <print_log@plt>
lea    0xed5(%rip),%rdi
pop    %rax
jmp    1040 <print_log@plt>
cmp    $0x100,%eax
jne    1192 <check_for_ansible+0x52>
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3d(%rip),%rdi
jmp    11a5 <check_for_ansible+0x65>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"checking for ansible\00"
@.str.1 = [30 x i8] c"which ansible >/dev/null 2>&1\00"
@.str.2 = [41 x i8] c"I cannot find ansible on your computer.\0A\00"
@.str.3 = [44 x i8] c"Please install ansible, then run me again.\0A\00"
@.str.4 = [18 x i8] c"-- ansible exists\00"
@.str.5 = [16 x i8] c"-- moving on...\00"
@.str.6 = [44 x i8] c"I could not find ansible on your computer.\0A\00"
@.str.7 = [38 x i8] c"I got an error when I looked for it.\0A\00"
define void @check_for_ansible() {
%1 = alloca i32
%2 = call i32 @print_log(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 @print_log(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @print_log(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %20
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %13
br label %21
21: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"checking for ansible\00"
@.str.1 = [30 x i8] c"which ansible >/dev/null 2>&1\00"
@.str.4 = [18 x i8] c"-- ansible exists\00"
@.str.5 = [16 x i8] c"-- moving on...\00"
@str = [43 x i8] c"I could not find ansible on your computer.\00"
@str.8 = [37 x i8] c"I got an error when I looked for it.\00"
@str.9 = [40 x i8] c"I cannot find ansible on your computer.\00"
@str.10 = [43 x i8] c"Please install ansible, then run me again.\00"
define void @check_for_ansible() {
%1 = tail call i32 @print_log(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
switch i32 %2, label %10 [
i32 256, label %3
i32 0, label %7
]
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = tail call i32 @print_log(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @print_log(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
ret void
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.8, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
}