#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 */
typedef int /*<<< orphan*/ mov;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
const char *cell(int mov) {
  static char buf[6 + 3 + sizeof(mov) * 3];
  if (mov == 0)
    return "m[p]";
  if (mov < 0)
    sprintf(buf, "m[p-%d]", -mov);
  else
    sprintf(buf, "m[p+%d]", mov);
  return buf;
}


x86 assembly (clang, -O0):
<cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1135 <cell+0x25>
lea    0xed4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <cell+0x6d>
cmpl   $0x0,-0xc(%rbp)
jge    115c <cell+0x4c>
xor    %edx,%edx
sub    -0xc(%rbp),%edx
lea    0x2ef5(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1172 <cell+0x62>
mov    -0xc(%rbp),%edx
lea    0x2eda(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2ec7(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cell>:
push   %rbx
test   %edi,%edi
je     1129 <cell+0x19>
mov    %edi,%edx
js     1132 <cell+0x22>
lea    0x2f20(%rip),%rbx
lea    0xee6(%rip),%rsi
jmp    1142 <cell+0x32>
lea    0xed0(%rip),%rbx
jmp    114a <cell+0x3a>
neg    %edx
lea    0x2f05(%rip),%rbx
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@cell.buf = internal global [21 x i8] zeroinitializer
@.str = [5 x i8] c"m[p]\00"
@.str.1 = [8 x i8] c"m[p-%d]\00"
@.str.2 = [8 x i8] c"m[p+%d]\00"
define i8* @cell(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %18
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sub nsw i32 0, %11
%13 = call i32 @sprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %17
14: ; preds = %7
%15 = load i32, i32* %3
%16 = call i32 @sprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %10
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), i8** %2
br label %18
18: ; preds = %17, %6
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@cell.buf = internal global [21 x i8] zeroinitializer
@.str = [5 x i8] c"m[p]\00"
@.str.1 = [8 x i8] c"m[p-%d]\00"
@.str.2 = [8 x i8] c"m[p+%d]\00"
define i8* @cell(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = sub nsw i32 0, %0
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %10
8: ; preds = %3
%9 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %10
10: ; preds = %5, %8, %1
%11 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), %8 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @cell.buf, i64 0, i64 0), %5 ]
ret i8* %11
}