#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*/ read_assert(int /*<<< orphan*/, unsigned char *, int);
int /*<<< orphan*/ write_assert(int, char *, int);
int get_column() {
  write_assert(1, "\e[6n", 4);
  unsigned char tmp;
  int column = 0;
  do {
    read_assert(0, &tmp, 1);
  } while (tmp != ';');
  read_assert(0, &tmp, 1);
  while (tmp != 'R') {
    column = column * 10 + tmp - '0';
    read_assert(0, &tmp, 1);
  }
  return column;
}


x86 assembly (clang, -O0):
<get_column>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
lea    0xecc(%rip),%rsi
mov    $0x4,%edx
call   1040 <write_assert@plt>
movl   $0x0,-0x8(%rbp)
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read_assert@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x3b,%eax
jne    1145 <get_column+0x25>
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read_assert@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x52,%eax
je     11a4 <get_column+0x84>
imul   $0xa,-0x8(%rbp),%eax
movzbl -0x1(%rbp),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read_assert@plt>
jmp    1172 <get_column+0x52>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_column>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
call   1040 <write_assert@plt>
lea    0x7(%rsp),%rbx
nop
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <read_assert@plt>
cmpb   $0x3b,0x7(%rsp)
jne    1140 <get_column+0x20>
xor    %ebx,%ebx
lea    0x7(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read_assert@plt>
mov    0x7(%rsp),%al
cmp    $0x52,%al
je     11a4 <get_column+0x84>
xor    %ebx,%ebx
lea    0x7(%rsp),%r14
nopl   0x0(%rax,%rax,1)
movzbl %al,%eax
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
add    $0xffffffd0,%ebx
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read_assert@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x52,%al
jne    1180 <get_column+0x60>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[6n\00"
define i32 @get_column() {
%1 = alloca i8
%2 = alloca i32
%3 = call i32 @write_assert(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
store i32 0, i32* %2
br label %4
4: ; preds = %6, %0
%5 = call i32 @read_assert(i32 0, i8* %1, i32 1)
br label %6
6: ; preds = %4
%7 = load i8, i8* %1
%8 = zext i8 %7 to i32
%9 = icmp ne i32 %8, 59
br i1 %9, label %4, label %10
10: ; preds = %6
%11 = call i32 @read_assert(i32 0, i8* %1, i32 1)
br label %12
12: ; preds = %16, %10
%13 = load i8, i8* %1
%14 = zext i8 %13 to i32
%15 = icmp ne i32 %14, 82
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 10
%19 = load i8, i8* %1
%20 = zext i8 %19 to i32
%21 = add nsw i32 %18, %20
%22 = sub nsw i32 %21, 48
store i32 %22, i32* %2
%23 = call i32 @read_assert(i32 0, i8* %1, i32 1)
br label %12
24: ; preds = %12
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[6n\00"
define i32 @get_column() {
%1 = alloca i8
%2 = tail call i32 @write_assert(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
br label %3
3: ; preds = %3, %0
%4 = call i32 @read_assert(i32 0, i8* %1, i32 1)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 59
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = call i32 @read_assert(i32 0, i8* %1, i32 1)
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 82
br i1 %10, label %21, label %11
11: ; preds = %7, %11
%12 = phi i8 [ %19, %11 ], [ %9, %7 ]
%13 = phi i32 [ %17, %11 ], [ 0, %7 ]
%14 = zext i8 %12 to i32
%15 = mul nsw i32 %13, 10
%16 = add i32 %15, -48
%17 = add i32 %16, %14
%18 = call i32 @read_assert(i32 0, i8* %1, i32 1)
%19 = load i8, i8* %1
%20 = icmp eq i8 %19, 82
br i1 %20, label %21, label %11
21: ; preds = %11, %7
%22 = phi i32 [ 0, %7 ], [ %17, %11 ]
ret i32 %22
}