#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 */
unsigned char memcmp(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ transceiver_send(unsigned char *, unsigned char *);
unsigned char net_set_params(unsigned char addr, unsigned char ack_wait_time) {
  unsigned char d[5], res[5];
  memset(res, 0, 5);
  d[0] = 255;
  d[1] = addr;
  d[2] = ack_wait_time;
  d[3] = 0;
  d[4] = 0;
  if (!transceiver_send(d, res))
    return 1;
  return memcmp(d, res, 5);
}


x86 assembly (clang, -O0):
<net_set_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
lea    -0xd(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
movb   $0xff,-0x8(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x7(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x6(%rbp)
movb   $0x0,-0x5(%rbp)
movb   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xd(%rbp),%rsi
call   1030 <transceiver_send@plt>
cmp    $0x0,%eax
jne    118b <net_set_params+0x5b>
movb   $0x1,-0x1(%rbp)
jmp    11a0 <net_set_params+0x70>
lea    -0x8(%rbp),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x5,%edx
call   1050 <memcmp@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_set_params>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xb(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
movb   $0xff,0x6(%rsp)
mov    %bpl,0x7(%rsp)
mov    %bl,0x8(%rsp)
movw   $0x0,0x9(%rsp)
lea    0x6(%rsp),%rdi
mov    %r14,%rsi
call   1030 <transceiver_send@plt>
test   %eax,%eax
je     118c <net_set_params+0x5c>
lea    0x6(%rsp),%rdi
lea    0xb(%rsp),%rsi
mov    $0x5,%edx
call   1050 <memcmp@plt>
jmp    118e <net_set_params+0x5e>
mov    $0x1,%al
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @net_set_params(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca [5 x i8]
%7 = alloca [5 x i8]
store i8 %0, i8* %4
store i8 %1, i8* %5
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 5)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
store i8 -1, i8* %10
%11 = load i8, i8* %4
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 1
store i8 %11, i8* %12
%13 = load i8, i8* %5
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 2
store i8 %13, i8* %14
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 3
store i8 0, i8* %15
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 4
store i8 0, i8* %16
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%19 = call i32 @transceiver_send(i8* %17, i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %2
store i8 1, i8* %3
br label %26
22: ; preds = %2
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%25 = call zeroext i8 @memcmp(i8* %23, i8* %24, i32 5)
store i8 %25, i8* %3
br label %26
26: ; preds = %22, %21
%27 = load i8, i8* %3
ret i8 %27
}

LLVM IR (-O2):
define zeroext i8 @net_set_params(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 5)
store i8 -1, i8* %5
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
store i8 %0, i8* %8
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
store i8 %1, i8* %9
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
store i8 0, i8* %10
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 0, i8* %11
%12 = call i32 @transceiver_send(i8* %5, i8* %6)
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = call zeroext i8 @memcmp(i8* %5, i8* %6, i32 5)
br label %16
16: ; preds = %2, %14
%17 = phi i8 [ %15, %14 ], [ 1, %2 ]
ret i8 %17
}