#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*/ al_gen_segment(int, int /*<<< orphan*/, int, char *, int *,
                                  int *, int);
scalar_t__ al_last_command_failed();
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int al_segment_status(int *is_first, int *last_bg, int position) {
  char text[8];
  if (al_last_command_failed()) {
    snprintf(text, 8, " %s ", "✘");
    al_gen_segment(196, 0, 1, text, is_first, last_bg, position);
  }
  return 0;
}


x86 assembly (clang, -O0):
<al_segment_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1050 <al_last_command_failed@plt>
cmp    $0x0,%rax
je     1193 <al_segment_status+0x63>
lea    -0x1c(%rbp),%rdi
mov    $0x8,%esi
lea    0xe9c(%rip),%rdx
lea    0xe9a(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x1c(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x14(%rbp),%eax
mov    $0xc4,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    %eax,(%rsp)
call   1040 <al_gen_segment@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<al_segment_status>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <al_last_command_failed@plt>
test   %rax,%rax
je     118b <al_segment_status+0x5b>
lea    0xeab(%rip),%rdx
lea    0xea9(%rip),%rcx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x8,%esi
call   1030 <snprintf@plt>
mov    %ebp,(%rsp)
mov    $0xc4,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    %r15,%rcx
mov    %rbx,%r8
mov    %r14,%r9
call   1040 <al_gen_segment@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" %s \00"
@.str.1 = [4 x i8] c"\E2\9C\98\00"
define i32 @al_segment_status(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [8 x i8]
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = call i64 (...) @al_last_command_failed()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%12 = call i32 @snprintf(i8* %11, i32 8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%14 = load i32*, i32** %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %6
%17 = call i32 @al_gen_segment(i32 196, i32 0, i32 1, i8* %13, i32* %14, i32* %15, i32 %16)
br label %18
18: ; preds = %10, %3
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c" %s \00"
@.str.1 = [4 x i8] c"\E2\9C\98\00"
define i32 @al_segment_status(i32* %0, i32* %1, i32 %2) {
%4 = alloca [8 x i8]
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%6 = tail call i64 (...) @al_last_command_failed()
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = call i32 @snprintf(i8* %5, i32 8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @al_gen_segment(i32 196, i32 0, i32 1, i8* %5, i32* %0, i32* %1, i32 %2)
br label %11
11: ; preds = %8, %3
ret i32 0
}