#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 */
struct feed_buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ feed_buf_write_character(struct feed_buf *const,
                                            unsigned char const);
char feed_buf_write_number(struct feed_buf *const, long);
char feed_esc_write_prefix(struct feed_buf *const);
char feed_esc_write_n1(struct feed_buf *const p_buf, unsigned int const i_count,
                       unsigned char const c_direction) {
  char b_result;
  b_result = feed_esc_write_prefix(p_buf);
  if (b_result) {
    if (1 != i_count) {
      b_result = feed_buf_write_number(p_buf, (signed long int)(i_count));
    }
    if (b_result) {
      feed_buf_write_character(p_buf, c_direction);
    }
  }
  return b_result;
}


x86 assembly (clang, -O0):
<feed_esc_write_n1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <feed_esc_write_prefix@plt>
mov    %al,-0xe(%rbp)
cmpb   $0x0,-0xe(%rbp)
je     1195 <feed_esc_write_n1+0x65>
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
je     1179 <feed_esc_write_n1+0x49>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    %eax,%esi
call   1050 <feed_buf_write_number@plt>
mov    %al,-0xe(%rbp)
cmpb   $0x0,-0xe(%rbp)
je     1190 <feed_esc_write_n1+0x60>
mov    -0x8(%rbp),%rdi
movzbl -0xd(%rbp),%esi
call   1040 <feed_buf_write_character@plt>
jmp    1195 <feed_esc_write_n1+0x65>
movsbl -0xe(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<feed_esc_write_n1>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <feed_esc_write_prefix@plt>
test   %al,%al
je     116d <feed_esc_write_n1+0x3d>
mov    %eax,%ebx
cmp    $0x1,%ebp
je     115f <feed_esc_write_n1+0x2f>
mov    %ebp,%esi
mov    %r14,%rdi
call   1050 <feed_buf_write_number@plt>
mov    %eax,%ebx
test   %al,%al
je     116d <feed_esc_write_n1+0x3d>
movzbl %r15b,%esi
mov    %r14,%rdi
call   1040 <feed_buf_write_character@plt>
jmp    116f <feed_esc_write_n1+0x3f>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.feed_buf = type { i32 }
define signext i8 @feed_esc_write_n1(%struct.feed_buf* %0, i32 %1, i8 zeroext %2) {
%4 = alloca %struct.feed_buf*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store %struct.feed_buf* %0, %struct.feed_buf** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%8 = load %struct.feed_buf*, %struct.feed_buf** %4
%9 = call signext i8 @feed_esc_write_prefix(%struct.feed_buf* %8)
store i8 %9, i8* %7
%10 = load i8, i8* %7
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %3
%13 = load i32, i32* %5
%14 = icmp ne i32 1, %13
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load %struct.feed_buf*, %struct.feed_buf** %4
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = call signext i8 @feed_buf_write_number(%struct.feed_buf* %16, i64 %18)
store i8 %19, i8* %7
br label %20
20: ; preds = %15, %12
%21 = load i8, i8* %7
%22 = icmp ne i8 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load %struct.feed_buf*, %struct.feed_buf** %4
%25 = load i8, i8* %6
%26 = call i32 @feed_buf_write_character(%struct.feed_buf* %24, i8 zeroext %25)
br label %27
27: ; preds = %23, %20
br label %28
28: ; preds = %27, %3
%29 = load i8, i8* %7
ret i8 %29
}

LLVM IR (-O2):
%struct.feed_buf = type { i32 }
define signext i8 @feed_esc_write_n1(%struct.feed_buf* %0, i32 %1, i8 zeroext %2) {
%4 = tail call signext i8 @feed_esc_write_prefix(%struct.feed_buf* %0)
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = icmp eq i32 %1, 1
br i1 %7, label %12, label %8
8: ; preds = %6
%9 = zext i32 %1 to i64
%10 = tail call signext i8 @feed_buf_write_number(%struct.feed_buf* %0, i64 %9)
%11 = icmp eq i8 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6, %8
%13 = phi i8 [ %10, %8 ], [ %4, %6 ]
%14 = tail call i32 @feed_buf_write_character(%struct.feed_buf* %0, i8 zeroext %2)
br label %15
15: ; preds = %8, %12, %3
%16 = phi i8 [ %13, %12 ], [ 0, %8 ], [ 0, %3 ]
ret i8 %16
}