#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 atoi(char *);
int strlen(char *);
int parse_coords(char *buf, int *row, int *col) {
  if (strlen(buf) > 2 || strlen(buf) < 2) {
    return 1;
  }
  char rows[2];
  rows[0] = buf[0];
  rows[1] = '\0';
  char cols[2];
  cols[0] = buf[1];
  cols[1] = '\0';
  *col = atoi(cols);
  *row = atoi(rows);
  return 0;
}


x86 assembly (clang, -O0):
<parse_coords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jg     1158 <parse_coords+0x38>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jge    1164 <parse_coords+0x44>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <parse_coords+0x88>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x22(%rbp)
movb   $0x0,-0x21(%rbp)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x24(%rbp)
movb   $0x0,-0x23(%rbp)
lea    -0x24(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x22(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_coords>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0x1,%ebp
cmp    $0x2,%eax
jg     117f <parse_coords+0x5f>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     117f <parse_coords+0x5f>
mov    (%rbx),%al
mov    %al,0x6(%rsp)
movb   $0x0,0x7(%rsp)
mov    0x1(%rbx),%al
mov    %al,0x4(%rsp)
movb   $0x0,0x5(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <atoi@plt>
mov    %eax,(%r15)
lea    0x6(%rsp),%rdi
call   1040 <atoi@plt>
mov    %eax,(%r14)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_coords(i8* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [2 x i8]
%9 = alloca [2 x i8]
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%10 = load i8*, i8** %5
%11 = call i32 @strlen(i8* %10)
%12 = icmp sgt i32 %11, 2
br i1 %12, label %17, label %13
13: ; preds = %3
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %13, %3
store i32 1, i32* %4
br label %35
18: ; preds = %13
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
store i8 %21, i8* %22
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
store i8 0, i8* %23
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
store i8 %26, i8* %27
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 1
store i8 0, i8* %28
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%30 = call i32 @atoi(i8* %29)
%31 = load i32*, i32** %7
store i32 %30, i32* %31
%32 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%33 = call i32 @atoi(i8* %32)
%34 = load i32*, i32** %6
store i32 %33, i32* %34
store i32 0, i32* %4
br label %35
35: ; preds = %18, %17
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
define i32 @parse_coords(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca [2 x i8]
%5 = alloca [2 x i8]
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp sgt i32 %6, 2
br i1 %7, label %21, label %8
8: ; preds = %3
%9 = tail call i32 @strlen(i8* %0)
%10 = icmp slt i32 %9, 2
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%13 = load i8, i8* %0
store i8 %13, i8* %12
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 0, i8* %14
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds i8, i8* %0, i64 1
%17 = load i8, i8* %16
store i8 %17, i8* %15
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %18
%19 = call i32 @atoi(i8* %15)
store i32 %19, i32* %2
%20 = call i32 @atoi(i8* %12)
store i32 %20, i32* %1
br label %21
21: ; preds = %3, %8, %11
%22 = phi i32 [ 0, %11 ], [ 1, %8 ], [ 1, %3 ]
ret i32 %22
}