#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*/ printf(char *, ...);
void out_msg(const char *msg, int rc, int hw) {
  if (rc) {
    if (hw)
      printf("HW ");
    printf("%s: %s!\n", msg, rc ? "FAILURE" : "success");
  }
}


x86 assembly (clang, -O0):
<out_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116e <out_msg+0x5e>
cmpl   $0x0,-0x10(%rbp)
je     1144 <out_msg+0x34>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%ecx
lea    0xec3(%rip),%rdx
lea    0xeb4(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_msg>:
test   %esi,%esi
je     1143 <out_msg+0x33>
push   %rbx
mov    %rdi,%rbx
test   %edx,%edx
je     112a <out_msg+0x1a>
lea    0xedd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xed5(%rip),%rdx
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"HW \00"
@.str.1 = [9 x i8] c"%s: %s!\0A\00"
@.str.2 = [8 x i8] c"FAILURE\00"
@.str.3 = [8 x i8] c"success\00"
define void @out_msg(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %19)
br label %21
21: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"HW \00"
@.str.1 = [9 x i8] c"%s: %s!\0A\00"
@.str.2 = [8 x i8] c"FAILURE\00"
define void @out_msg(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = icmp eq i32 %2, 0
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %3
ret void
}