#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 error(int, char *);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ zaber_move_rel(int, int);
int cmd_xy(int argc, char *argv[]) {
  int nxsteps = 0, nysteps = 0;
  if (argc != 3)
    return error((-2), "Usage: xy [xsteps] [ysteps]");
  if (sscanf(argv[1], "%d", &nxsteps) != 1)
    return error((-2), "Error parsing xsteps.");
  if (sscanf(argv[2], "%d", &nysteps) != 1)
    return error((-2), "Error parsing ysteps.");
  zaber_move_rel(2, nxsteps);
  usleep(1000);
  zaber_move_rel(1, nysteps);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_xy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1180 <cmd_xy+0x40>
mov    $0xfffffffe,%edi
lea    0xe8d(%rip),%rsi
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    121f <cmd_xy+0xdf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8d(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11ba <cmd_xy+0x7a>
mov    $0xfffffffe,%edi
lea    0xe72(%rip),%rsi
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    121f <cmd_xy+0xdf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe53(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11f4 <cmd_xy+0xb4>
mov    $0xfffffffe,%edi
lea    0xe4e(%rip),%rsi
call   1050 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    121f <cmd_xy+0xdf>
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
call   1030 <zaber_move_rel@plt>
mov    $0x3e8,%edi
call   1060 <usleep@plt>
mov    -0x18(%rbp),%esi
mov    $0x1,%edi
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_xy>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
cmp    $0x3,%edi
jne    11bb <cmd_xy+0x7b>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeb4(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11d1 <cmd_xy+0x91>
mov    0x10(%rbx),%rdi
lea    0xe9a(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11da <cmd_xy+0x9a>
mov    0xc(%rsp),%esi
mov    $0x2,%edi
call   1030 <zaber_move_rel@plt>
mov    $0x3e8,%edi
call   1060 <usleep@plt>
mov    0x8(%rsp),%esi
mov    $0x1,%edi
call   1030 <zaber_move_rel@plt>
xor    %eax,%eax
jmp    11eb <cmd_xy+0xab>
lea    0xe3e(%rip),%rsi
mov    $0xfffffffe,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <error@plt>
lea    0xe47(%rip),%rsi
jmp    11e1 <cmd_xy+0xa1>
lea    0xe54(%rip),%rsi
mov    $0xfffffffe,%edi
call   1050 <error@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Usage: xy [xsteps] [ysteps]\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Error parsing xsteps.\00"
@.str.3 = [22 x i8] c"Error parsing ysteps.\00"
define i32 @cmd_xy(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %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 @error(i32 -2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %3
br label %34
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @error(i32 -2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 %19, i32* %3
br label %34
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, 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 @error(i32 -2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 %27, i32* %3
br label %34
28: ; preds = %20
%29 = load i32, i32* %6
%30 = call i32 @zaber_move_rel(i32 2, i32 %29)
%31 = call i32 @usleep(i32 1000)
%32 = load i32, i32* %7
%33 = call i32 @zaber_move_rel(i32 1, i32 %32)
store i32 0, i32* %3
br label %34
34: ; preds = %28, %26, %18, %10
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [28 x i8] c"Usage: xy [xsteps] [ysteps]\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Error parsing xsteps.\00"
@.str.3 = [22 x i8] c"Error parsing ysteps.\00"
define i32 @cmd_xy(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = icmp eq i32 %0, 3
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @error(i32 -2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %30
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = icmp eq i32 %13, 1
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = call i32 @error(i32 -2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %30
17: ; preds = %10
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%21 = icmp eq i32 %20, 1
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = call i32 @error(i32 -2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %30
24: ; preds = %17
%25 = load i32, i32* %3
%26 = call i32 @zaber_move_rel(i32 2, i32 %25)
%27 = call i32 @usleep(i32 1000)
%28 = load i32, i32* %4
%29 = call i32 @zaber_move_rel(i32 1, i32 %28)
br label %30
30: ; preds = %24, %22, %15, %8
%31 = phi i32 [ %9, %8 ], [ %16, %15 ], [ %23, %22 ], [ 0, %24 ]
ret i32 %31
}