#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 canopen_sdo_download_exp(int, int, int, int /*<<< orphan*/, int, int);
int homing_faulhaber_motor(int sock, int node) {
  int err = 0;
  if ((err = canopen_sdo_download_exp(sock, node, 0x6060, 0, 0x0006, 0)) != 0) {
    return err;
  }
  if ((err = canopen_sdo_download_exp(sock, node, 0x6098, 0, 35, 2)) != 0) {
    return err;
  }
  if ((err = canopen_sdo_download_exp(sock, node, 0x4060, 0, 0x001F, 0)) != 0) {
    return err;
  }
  if ((err = canopen_sdo_download_exp(sock, node, 0x6060, 0, 0x0001, 1)) != 0) {
    return err;
  }
  return 0;
}


x86 assembly (clang, -O0):
<homing_faulhaber_motor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x6060,%edx
xor    %r9d,%r9d
mov    $0x6,%r8d
mov    %r9d,%ecx
call   1030 <canopen_sdo_download_exp@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1158 <homing_faulhaber_motor+0x48>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f9 <homing_faulhaber_motor+0xe9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x6098,%edx
xor    %ecx,%ecx
mov    $0x23,%r8d
mov    $0x2,%r9d
call   1030 <canopen_sdo_download_exp@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     118d <homing_faulhaber_motor+0x7d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f9 <homing_faulhaber_motor+0xe9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x4060,%edx
xor    %r9d,%r9d
mov    $0x1f,%r8d
mov    %r9d,%ecx
call   1030 <canopen_sdo_download_exp@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     11c0 <homing_faulhaber_motor+0xb0>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f9 <homing_faulhaber_motor+0xe9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x6060,%edx
xor    %ecx,%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
call   1030 <canopen_sdo_download_exp@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     11f2 <homing_faulhaber_motor+0xe2>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f9 <homing_faulhaber_motor+0xe9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<homing_faulhaber_motor>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x6060,%edx
xor    %ecx,%ecx
mov    $0x6,%r8d
xor    %r9d,%r9d
call   1030 <canopen_sdo_download_exp@plt>
test   %eax,%eax
jne    116d <homing_faulhaber_motor+0x5d>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x6098,%edx
xor    %ecx,%ecx
mov    $0x23,%r8d
mov    $0x2,%r9d
call   1030 <canopen_sdo_download_exp@plt>
test   %eax,%eax
jne    116d <homing_faulhaber_motor+0x5d>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x4060,%edx
xor    %ecx,%ecx
mov    $0x1f,%r8d
xor    %r9d,%r9d
call   1030 <canopen_sdo_download_exp@plt>
test   %eax,%eax
je     1174 <homing_faulhaber_motor+0x64>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x6060,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <canopen_sdo_download_exp@plt>

LLVM IR (-O0):
define i32 @homing_faulhaber_motor(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @canopen_sdo_download_exp(i32 %7, i32 %8, i32 24672, i32 0, i32 6, i32 0)
store i32 %9, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* %6
store i32 %12, i32* %3
br label %35
13: ; preds = %2
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @canopen_sdo_download_exp(i32 %14, i32 %15, i32 24728, i32 0, i32 35, i32 2)
store i32 %16, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %35
20: ; preds = %13
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 @canopen_sdo_download_exp(i32 %21, i32 %22, i32 16480, i32 0, i32 31, i32 0)
store i32 %23, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = load i32, i32* %6
store i32 %26, i32* %3
br label %35
27: ; preds = %20
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i32 @canopen_sdo_download_exp(i32 %28, i32 %29, i32 24672, i32 0, i32 1, i32 1)
store i32 %30, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = load i32, i32* %6
store i32 %33, i32* %3
br label %35
34: ; preds = %27
store i32 0, i32* %3
br label %35
35: ; preds = %34, %32, %25, %18, %11
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @homing_faulhaber_motor(i32 %0, i32 %1) {
%3 = tail call i32 @canopen_sdo_download_exp(i32 %0, i32 %1, i32 24672, i32 0, i32 6, i32 0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = tail call i32 @canopen_sdo_download_exp(i32 %0, i32 %1, i32 24728, i32 0, i32 35, i32 2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = tail call i32 @canopen_sdo_download_exp(i32 %0, i32 %1, i32 16480, i32 0, i32 31, i32 0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @canopen_sdo_download_exp(i32 %0, i32 %1, i32 24672, i32 0, i32 1, i32 1)
br label %13
13: ; preds = %11, %8, %5, %2
%14 = phi i32 [ %3, %2 ], [ %6, %5 ], [ %9, %8 ], [ %12, %11 ]
ret i32 %14
}