#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*/ assert(int);
int /*<<< orphan*/ printf(char *);
int software_installed(char *);
void test_software_exists() {
  char *test_software = "nano";
  char cmdstr[256];
  printf("test_software_exists...");
  assert(software_installed(test_software));
  char *test_software_non = "fooby_null";
  assert(!software_installed(test_software_non));
  printf("Ok\n");
}


x86 assembly (clang, -O0):
<test_software_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <software_installed@plt>
mov    %eax,%edi
call   1040 <assert@plt>
lea    0xeb4(%rip),%rax
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rdi
call   1050 <software_installed@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_software_exists>:
push   %rax
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
call   1060 <software_installed@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xeb6(%rip),%rdi
call   1060 <software_installed@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xea8(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"nano\00"
@.str.1 = [24 x i8] c"test_software_exists...\00"
@.str.2 = [11 x i8] c"fooby_null\00"
@.str.3 = [4 x i8] c"Ok\0A\00"
define void @test_software_exists() {
%1 = alloca i8*
%2 = alloca [256 x i8]
%3 = alloca i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8*, i8** %1
%6 = call i32 @software_installed(i8* %5)
%7 = call i32 @assert(i32 %6)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @software_installed(i8* %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"nano\00"
@.str.1 = [24 x i8] c"test_software_exists...\00"
@.str.2 = [11 x i8] c"fooby_null\00"
@str = [3 x i8] c"Ok\00"
define void @test_software_exists() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @software_installed(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @assert(i32 %2)
%4 = tail call i32 @software_installed(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}