#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 /*<<< orphan*/);
int set_ramp_faulhaber(int sock, int node, int speed) {
  int err = 0;
  if ((err = canopen_sdo_download_exp(sock, node, 0x6083, 0, speed, 0)) != 0) {
    return err;
  }
  if ((err = canopen_sdo_download_exp(sock, node, 0x6084, 0, speed, 0)) != 0) {
    return err;
  }
  return 0;
}


x86 assembly (clang, -O0):
<set_ramp_faulhaber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
mov    $0x6083,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
call   1030 <canopen_sdo_download_exp@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1159 <set_ramp_faulhaber+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1191 <set_ramp_faulhaber+0x81>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
mov    $0x6084,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
call   1030 <canopen_sdo_download_exp@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     118a <set_ramp_faulhaber+0x7a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1191 <set_ramp_faulhaber+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ramp_faulhaber>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x6083,%edx
xor    %ecx,%ecx
mov    %r14d,%r8d
xor    %r9d,%r9d
call   1030 <canopen_sdo_download_exp@plt>
test   %eax,%eax
je     1136 <set_ramp_faulhaber+0x26>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x6084,%edx
xor    %ecx,%ecx
mov    %r14d,%r8d
xor    %r9d,%r9d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <canopen_sdo_download_exp@plt>

LLVM IR (-O0):
define i32 @set_ramp_faulhaber(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = call i32 @canopen_sdo_download_exp(i32 %9, i32 %10, i32 24707, i32 0, i32 %11, i32 0)
store i32 %12, i32* %8
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i32, i32* %8
store i32 %15, i32* %4
br label %25
16: ; preds = %3
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @canopen_sdo_download_exp(i32 %17, i32 %18, i32 24708, i32 0, i32 %19, i32 0)
store i32 %20, i32* %8
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = load i32, i32* %8
store i32 %23, i32* %4
br label %25
24: ; preds = %16
store i32 0, i32* %4
br label %25
25: ; preds = %24, %22, %14
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @set_ramp_faulhaber(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @canopen_sdo_download_exp(i32 %0, i32 %1, i32 24707, i32 0, i32 %2, i32 0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @canopen_sdo_download_exp(i32 %0, i32 %1, i32 24708, i32 0, i32 %2, i32 0)
br label %8
8: ; preds = %6, %3
%9 = phi i32 [ %4, %3 ], [ %7, %6 ]
ret i32 %9
}