long move(string)
char *string[];
{
  long px, py, dpx, dpy;
  if (sscanf(*string, "%d %d", &dpx, &dpy) != 2)
    return (0);
  if (!char_getcursor(&px, &py))
    return (0);
  if (!char_setcursor((px + dpx), (py + dpy)))
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb6(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   1030 <sscanf@plt>
cmp    $0x2,%eax
je     116f <move+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    11c9 <move+0x99>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1050 <char_getcursor@plt>
cmp    $0x0,%eax
jne    1194 <move+0x64>
movq   $0x0,-0x8(%rbp)
jmp    11c9 <move+0x99>
mov    -0x18(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1040 <char_setcursor@plt>
cmp    $0x0,%eax
jne    11c1 <move+0x91>
movq   $0x0,-0x8(%rbp)
jmp    11c9 <move+0x99>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
push   %rbx
sub    $0x20,%rsp
mov    (%rdi),%rdi
lea    0xec1(%rip),%rsi
xor    %ebx,%ebx
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
xor    %eax,%eax
call   1030 <sscanf@plt>
cmp    $0x2,%eax
jne    118d <move+0x5d>
xor    %ebx,%ebx
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <char_getcursor@plt>
test   %eax,%eax
je     118d <move+0x5d>
mov    0x8(%rsp),%rdi
add    0x18(%rsp),%rdi
mov    (%rsp),%rsi
add    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <char_setcursor@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
define i64 @move(i8** %0) {
%2 = alloca i64
%3 = alloca i8**
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i8** %0, i8*** %3
%8 = load i8**, i8*** %3
%9 = load i8*, i8** %8
%10 = call i32 (i8*, i8*, ...) @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %6, i64* %7)
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %1
store i64 0, i64* %2
br label %28
13: ; preds = %1
%14 = call i32 (i64*, i64*, ...) bitcast (i32 (...)* @char_getcursor to i32 (i64*, i64*, ...)*)(i64* %4, i64* %5)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %13
store i64 0, i64* %2
br label %28
17: ; preds = %13
%18 = load i64, i64* %4
%19 = load i64, i64* %6
%20 = add nsw i64 %18, %19
%21 = load i64, i64* %5
%22 = load i64, i64* %7
%23 = add nsw i64 %21, %22
%24 = call i32 (i64, i64, ...) bitcast (i32 (...)* @char_setcursor to i32 (i64, i64, ...)*)(i64 %20, i64 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %17
store i64 0, i64* %2
br label %28
27: ; preds = %17
store i64 1, i64* %2
br label %28
28: ; preds = %27, %26, %16, %12
%29 = load i64, i64* %2
ret i64 %29
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
define i64 @move(i8** nocapture %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %2 to i8*
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = load i8*, i8** %0
%11 = call i32 (i8*, i8*, ...) @sscanf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %4, i64* %5)
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %26
13: ; preds = %1
%14 = call i32 (i64*, i64*, ...) bitcast (i32 (...)* @char_getcursor to i32 (i64*, i64*, ...)*)(i64* %2, i64* %3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = load i64, i64* %2
%18 = load i64, i64* %4
%19 = add nsw i64 %18, %17
%20 = load i64, i64* %3
%21 = load i64, i64* %5
%22 = add nsw i64 %21, %20
%23 = call i32 (i64, i64, ...) bitcast (i32 (...)* @char_setcursor to i32 (i64, i64, ...)*)(i64 %19, i64 %22)
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
br label %26
26: ; preds = %16, %13, %1
%27 = phi i64 [ 0, %1 ], [ 0, %13 ], [ %25, %16 ]
ret i64 %27
}