#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 bitToDecimal(char *);
void *malloc(int);
int *bitToCoordinates(char *string) {
  int *coordinates = malloc(sizeof(int) * 2);
  char *xString = malloc(sizeof(char) * 3);
  char *yString = malloc(sizeof(char) * 3);
  xString[0] = string[0];
  xString[1] = string[3];
  xString[2] = '\0';
  yString[0] = string[1];
  yString[1] = string[2];
  yString[2] = '\0';
  int x = bitToDecimal(xString);
  int y = bitToDecimal(yString);
  coordinates[0] = x;
  coordinates[1] = y;
  return coordinates;
}


x86 assembly (clang, -O0):
<bitToCoordinates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x18(%rbp),%rdi
call   1040 <bitToDecimal@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <bitToDecimal@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitToCoordinates>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
mov    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,%r12
mov    (%r15),%al
mov    %al,(%rbx)
mov    0x3(%r15),%al
mov    %al,0x1(%rbx)
movb   $0x0,0x2(%rbx)
mov    0x1(%r15),%al
mov    %al,(%r12)
mov    0x2(%r15),%al
mov    %al,0x1(%r12)
movb   $0x0,0x2(%r12)
mov    %rbx,%rdi
call   1040 <bitToDecimal@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1040 <bitToDecimal@plt>
mov    %ebx,(%r14)
mov    %eax,0x4(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @bitToCoordinates(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = call i8* @malloc(i32 8)
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %3
%10 = call i8* @malloc(i32 3)
store i8* %10, i8** %4
%11 = call i8* @malloc(i32 3)
store i8* %11, i8** %5
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 0
store i8 %14, i8* %16
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 3
%19 = load i8, i8* %18
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %19, i8* %21
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8 0, i8* %23
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 0
store i8 %26, i8* %28
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 2
%31 = load i8, i8* %30
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 1
store i8 %31, i8* %33
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 2
store i8 0, i8* %35
%36 = load i8*, i8** %4
%37 = call i32 @bitToDecimal(i8* %36)
store i32 %37, i32* %6
%38 = load i8*, i8** %5
%39 = call i32 @bitToDecimal(i8* %38)
store i32 %39, i32* %7
%40 = load i32, i32* %6
%41 = load i32*, i32** %3
%42 = getelementptr inbounds i32, i32* %41, i64 0
store i32 %40, i32* %42
%43 = load i32, i32* %7
%44 = load i32*, i32** %3
%45 = getelementptr inbounds i32, i32* %44, i64 1
store i32 %43, i32* %45
%46 = load i32*, i32** %3
ret i32* %46
}

LLVM IR (-O2):
define noalias i32* @bitToCoordinates(i8* nocapture %0) {
%2 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%3 = bitcast i8* %2 to i32*
%4 = tail call dereferenceable_or_null(3) i8* @malloc(i32 3)
%5 = tail call dereferenceable_or_null(3) i8* @malloc(i32 3)
%6 = load i8, i8* %0
store i8 %6, i8* %4
%7 = getelementptr inbounds i8, i8* %0, i64 3
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %8, i8* %9
%10 = getelementptr inbounds i8, i8* %4, i64 2
store i8 0, i8* %10
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
store i8 %12, i8* %5
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %14, i8* %15
%16 = getelementptr inbounds i8, i8* %5, i64 2
store i8 0, i8* %16
%17 = tail call i32 @bitToDecimal(i8* %4)
%18 = tail call i32 @bitToDecimal(i8* %5)
store i32 %17, i32* %3
%19 = getelementptr inbounds i32, i32* %3, i64 1
store i32 %18, i32* %19
ret i32* %3
}