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


x86 assembly (clang, -O0):
<line_relative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb6(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x38(%rbp),%r8
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x3,%eax
je     1173 <line_relative+0x43>
movq   $0x0,-0x8(%rbp)
jmp    11d1 <line_relative+0xa1>
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1050 <char_getcursor@plt>
cmp    $0x0,%eax
jne    1198 <line_relative+0x68>
movq   $0x0,-0x8(%rbp)
jmp    11d1 <line_relative+0xa1>
mov    -0x28(%rbp),%rdi
add    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    $0x0,%al
call   1030 <char_putline@plt>
cmp    $0x0,%eax
jne    11c9 <line_relative+0x99>
movq   $0x0,-0x8(%rbp)
jmp    11d1 <line_relative+0xa1>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line_relative>:
push   %rbx
sub    $0x30,%rsp
mov    (%rdi),%rdi
lea    0xec1(%rip),%rsi
xor    %ebx,%ebx
lea    0x28(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x8(%rsp),%r8
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x3,%eax
jne    119a <line_relative+0x6a>
xor    %ebx,%ebx
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <char_getcursor@plt>
test   %eax,%eax
je     119a <line_relative+0x6a>
mov    0x28(%rsp),%rdi
add    0x18(%rsp),%rdi
mov    0x20(%rsp),%rsi
add    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   1030 <char_putline@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %rbx,%rax
add    $0x30,%rsp
pop    %rbx
ret

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

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