#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 */
char feed_buf_write_character(struct feed_buf *const, char);
char feed_buf_write_number(struct feed_buf *const, long);
char feed_esc_write_prefix(struct feed_buf *const);
char feed_esc_write_cup(struct feed_buf *const p_buf, unsigned int const i_row,
                        unsigned int const i_column) {
  char b_result;
  b_result = feed_esc_write_prefix(p_buf);
  if (b_result) {
    if (1 != i_row) {
      b_result = feed_buf_write_number(p_buf, (signed long int)(i_row));
    }
    if (b_result) {
      if (1 != i_column) {
        b_result = feed_buf_write_character(p_buf, ';');
        if (b_result) {
          b_result = feed_buf_write_number(p_buf, (signed long int)(i_column));
        }
      }
    }
    if (b_result) {
      b_result = feed_buf_write_character(p_buf, 'H');
    }
  }
  return b_result;
}


x86 assembly (clang, -O0):
<feed_esc_write_cup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <feed_esc_write_prefix@plt>
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     11e5 <feed_esc_write_cup+0xb5>
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
je     1177 <feed_esc_write_cup+0x47>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    %eax,%esi
call   1050 <feed_buf_write_number@plt>
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     11c5 <feed_esc_write_cup+0x95>
mov    $0x1,%eax
cmp    -0x10(%rbp),%eax
je     11c0 <feed_esc_write_cup+0x90>
mov    -0x8(%rbp),%rdi
mov    $0x3b,%esi
call   1040 <feed_buf_write_character@plt>
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     11bb <feed_esc_write_cup+0x8b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
mov    %eax,%esi
call   1050 <feed_buf_write_number@plt>
mov    %al,-0x11(%rbp)
jmp    11c0 <feed_esc_write_cup+0x90>
jmp    11c5 <feed_esc_write_cup+0x95>
cmpb   $0x0,-0x11(%rbp)
je     11e0 <feed_esc_write_cup+0xb0>
mov    -0x8(%rbp),%rdi
mov    $0x48,%esi
call   1040 <feed_buf_write_character@plt>
mov    %al,-0x11(%rbp)
jmp    11e5 <feed_esc_write_cup+0xb5>
movsbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<feed_esc_write_cup>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <feed_esc_write_prefix@plt>
test   %al,%al
je     118f <feed_esc_write_cup+0x5f>
cmp    $0x1,%ebp
je     1154 <feed_esc_write_cup+0x24>
mov    %ebp,%esi
mov    %rbx,%rdi
call   1050 <feed_buf_write_number@plt>
cmp    $0x1,%r14d
je     117a <feed_esc_write_cup+0x4a>
test   %al,%al
je     117a <feed_esc_write_cup+0x4a>
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1040 <feed_buf_write_character@plt>
test   %al,%al
je     118f <feed_esc_write_cup+0x5f>
mov    %r14d,%esi
mov    %rbx,%rdi
call   1050 <feed_buf_write_number@plt>
test   %al,%al
je     118f <feed_esc_write_cup+0x5f>
mov    %rbx,%rdi
mov    $0x48,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <feed_buf_write_character@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.feed_buf = type { i32 }
define signext i8 @feed_esc_write_cup(%struct.feed_buf* %0, i32 %1, i32 %2) {
%4 = alloca %struct.feed_buf*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store %struct.feed_buf* %0, %struct.feed_buf** %4
store i32 %1, i32* %5
store i32 %2, i32* %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 %45
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 %38
23: ; preds = %20
%24 = load i32, i32* %6
%25 = icmp ne i32 1, %24
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = load %struct.feed_buf*, %struct.feed_buf** %4
%28 = call signext i8 @feed_buf_write_character(%struct.feed_buf* %27, i8 signext 59)
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = icmp ne i8 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load %struct.feed_buf*, %struct.feed_buf** %4
%33 = load i32, i32* %6
%34 = zext i32 %33 to i64
%35 = call signext i8 @feed_buf_write_number(%struct.feed_buf* %32, i64 %34)
store i8 %35, i8* %7
br label %36
36: ; preds = %31, %26
br label %37
37: ; preds = %36, %23
br label %38
38: ; preds = %37, %20
%39 = load i8, i8* %7
%40 = icmp ne i8 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load %struct.feed_buf*, %struct.feed_buf** %4
%43 = call signext i8 @feed_buf_write_character(%struct.feed_buf* %42, i8 signext 72)
store i8 %43, i8* %7
br label %44
44: ; preds = %41, %38
br label %45
45: ; preds = %44, %3
%46 = load i8, i8* %7
ret i8 %46
}

LLVM IR (-O2):
%struct.feed_buf = type { i32 }
define signext i8 @feed_esc_write_cup(%struct.feed_buf* %0, i32 %1, i32 %2) {
%4 = tail call signext i8 @feed_esc_write_prefix(%struct.feed_buf* %0)
%5 = icmp eq i8 %4, 0
br i1 %5, label %27, label %6
6: ; preds = %3
%7 = icmp eq i32 %1, 1
br i1 %7, label %11, 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)
br label %11
11: ; preds = %8, %6
%12 = phi i8 [ %10, %8 ], [ %4, %6 ]
%13 = icmp ne i8 %12, 0
%14 = icmp ne i32 %2, 1
%15 = and i1 %14, %13
br i1 %15, label %16, label %22
16: ; preds = %11
%17 = tail call signext i8 @feed_buf_write_character(%struct.feed_buf* %0, i8 signext 59)
%18 = icmp eq i8 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %16
%20 = zext i32 %2 to i64
%21 = tail call signext i8 @feed_buf_write_number(%struct.feed_buf* %0, i64 %20)
br label %22
22: ; preds = %19, %11
%23 = phi i8 [ %21, %19 ], [ %12, %11 ]
%24 = icmp eq i8 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call signext i8 @feed_buf_write_character(%struct.feed_buf* %0, i8 signext 72)
br label %27
27: ; preds = %16, %22, %25, %3
%28 = phi i8 [ %26, %25 ], [ 0, %22 ], [ 0, %3 ], [ 0, %16 ]
ret i8 %28
}