int cmd_zmovrel(int argc, char *argv[]) {
  unsigned char unit = 0;
  int nsteps = 0;
  if (argc != 3)
    return error((-2), "Usage: zmovrel [unit] [nsteps]");
  if (sscanf(argv[1], "%hhu", &unit) != 1)
    return error((-2), "Error parsing unit.");
  if (sscanf(argv[2], "%d", &nsteps) != 1)
    return error((-2), "Error parsing posn.");
  if (unit < 1 || unit > 3)
    return error((-2), "Unit between 1 and %d only.", 3);
  zaber_move_rel(unit, nsteps);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_zmovrel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     116f <cmd_zmovrel+0x3f>
mov    $0xfffffffe,%edi
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    123a <cmd_zmovrel+0x10a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea1(%rip),%rsi
lea    -0x11(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11ad <cmd_zmovrel+0x7d>
mov    $0xfffffffe,%edi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    123a <cmd_zmovrel+0x10a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe7c(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11eb <cmd_zmovrel+0xbb>
mov    $0xfffffffe,%edi
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    123a <cmd_zmovrel+0x10a>
movzbl -0x11(%rbp),%eax
cmp    $0x1,%eax
jl     1205 <cmd_zmovrel+0xd5>
movzbl -0x11(%rbp),%eax
cmp    $0x3,%eax
jle    1225 <cmd_zmovrel+0xf5>
mov    $0xfffffffe,%edi
lea    0xe3e(%rip),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    123a <cmd_zmovrel+0x10a>
movzbl -0x11(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    $0x0,%al
call   1030 <zaber_move_rel@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_zmovrel>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xb(%rsp)
movl   $0x0,0xc(%rsp)
cmp    $0x3,%edi
jne    11a8 <cmd_zmovrel+0x78>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeca(%rip),%rsi
lea    0xb(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11c0 <cmd_zmovrel+0x90>
mov    0x10(%rbx),%rdi
lea    0xec7(%rip),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11c9 <cmd_zmovrel+0x99>
movzbl 0xb(%rsp),%edi
lea    -0x4(%rdi),%eax
cmp    $0xfc,%al
ja     11e6 <cmd_zmovrel+0xb6>
lea    0xeba(%rip),%rsi
mov    $0xfffffffe,%edi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <error@plt>
jmp    11dc <cmd_zmovrel+0xac>
lea    0xe51(%rip),%rsi
mov    $0xfffffffe,%edi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1050 <error@plt>
lea    0xe5d(%rip),%rsi
jmp    11d0 <cmd_zmovrel+0xa0>
lea    0xe6b(%rip),%rsi
mov    $0xfffffffe,%edi
xor    %eax,%eax
call   1050 <error@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0xc(%rsp),%esi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <zaber_move_rel@plt>
jmp    11de <cmd_zmovrel+0xae>

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: zmovrel [unit] [nsteps]\00"
@.str.1 = [5 x i8] c"%hhu\00"
@.str.2 = [20 x i8] c"Error parsing unit.\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [20 x i8] c"Error parsing posn.\00"
@.str.5 = [28 x i8] c"Unit between 1 and %d only.\00"
define i32 @cmd_zmovrel(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, ...)*)(i32 -2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %3
br label %43
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, i8*, ...) @sscanf(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, ...)*)(i32 -2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 %19, i32* %3
br label %43
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%25 = icmp ne i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, ...)*)(i32 -2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 %27, i32* %3
br label %43
28: ; preds = %20
%29 = load i8, i8* %6
%30 = zext i8 %29 to i32
%31 = icmp slt i32 %30, 1
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = load i8, i8* %6
%34 = zext i8 %33 to i32
%35 = icmp sgt i32 %34, 3
br i1 %35, label %36, label %38
36: ; preds = %32, %28
%37 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, i32, ...)*)(i32 -2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 3)
store i32 %37, i32* %3
br label %43
38: ; preds = %32
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = load i32, i32* %7
%42 = call i32 (i32, i32, ...) bitcast (i32 (...)* @zaber_move_rel to i32 (i32, i32, ...)*)(i32 %40, i32 %41)
store i32 0, i32* %3
br label %43
43: ; preds = %38, %36, %26, %18, %10
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: zmovrel [unit] [nsteps]\00"
@.str.1 = [5 x i8] c"%hhu\00"
@.str.2 = [20 x i8] c"Error parsing unit.\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [20 x i8] c"Error parsing posn.\00"
@.str.5 = [28 x i8] c"Unit between 1 and %d only.\00"
define i32 @cmd_zmovrel(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = alloca i32
store i8 0, i8* %3
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = icmp eq i32 %0, 3
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, ...)*)(i32 -2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %33
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%13 = icmp eq i32 %12, 1
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, ...)*)(i32 -2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %33
16: ; preds = %9
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = call i32 (i8*, i8*, ...) @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%20 = icmp eq i32 %19, 1
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, ...)*)(i32 -2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %33
23: ; preds = %16
%24 = load i8, i8* %3
%25 = add i8 %24, -4
%26 = icmp ult i8 %25, -3
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i32, i8*, i32, ...)*)(i32 -2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 3)
br label %33
29: ; preds = %23
%30 = zext i8 %24 to i32
%31 = load i32, i32* %4
%32 = call i32 (i32, i32, ...) bitcast (i32 (...)* @zaber_move_rel to i32 (i32, i32, ...)*)(i32 %30, i32 %31)
br label %33
33: ; preds = %29, %27, %21, %14, %7
%34 = phi i32 [ %8, %7 ], [ %15, %14 ], [ %22, %21 ], [ %28, %27 ], [ 0, %29 ]
ret i32 %34
}