#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 /*<<< orphan*/ zwave_sendClassCommand(unsigned int, int, int,
                                          unsigned char *, int);
void zwavecmd_association_remove(unsigned int id, unsigned int group,
                                 char *ids) {
  unsigned char buf[255];
  int n, v;
  v = 0;
  if (*ids) {
    while (*ids) {
      if (*ids >= '0' && *ids <= '9') {
        v = v * 10 + (*ids - '0');
      } else {
        buf[n++] = v;
        v = 0;
      }
      ids++;
    }
  }
  buf[0] = group;
  buf[1] = v;
  n = 2;
  zwave_sendClassCommand(id, 0x85, 0x4, buf, n);
}


x86 assembly (clang, -O0):
<zwavecmd_association_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x118(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ce <zwavecmd_association_remove+0xbe>
jmp    1141 <zwavecmd_association_remove+0x31>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c9 <zwavecmd_association_remove+0xb9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     118c <zwavecmd_association_remove+0x7c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     118c <zwavecmd_association_remove+0x7c>
imul   $0xa,-0x118(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x118(%rbp)
jmp    11b8 <zwavecmd_association_remove+0xa8>
mov    -0x118(%rbp),%eax
mov    %al,%cl
mov    -0x114(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x114(%rbp)
cltq
mov    %cl,-0x110(%rbp,%rax,1)
movl   $0x0,-0x118(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1141 <zwavecmd_association_remove+0x31>
jmp    11ce <zwavecmd_association_remove+0xbe>
mov    -0x8(%rbp),%eax
mov    %al,-0x110(%rbp)
mov    -0x118(%rbp),%eax
mov    %al,-0x10f(%rbp)
movl   $0x2,-0x114(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x110(%rbp),%rcx
mov    -0x114(%rbp),%r8d
mov    $0x85,%esi
mov    $0x4,%edx
call   1030 <zwave_sendClassCommand@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zwavecmd_association_remove>:
sub    $0x108,%rsp
mov    (%rdx),%cl
test   %cl,%cl
je     1161 <zwavecmd_association_remove+0x51>
add    $0x1,%rdx
xor    %r9d,%r9d
jmp    1149 <zwavecmd_association_remove+0x39>
cs nopw 0x0(%rax,%rax,1)
movslq %r8d,%rax
add    $0x1,%r8d
mov    %r9b,(%rsp,%rax,1)
xor    %r9d,%r9d
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
je     1164 <zwavecmd_association_remove+0x54>
lea    -0x30(%rcx),%eax
cmp    $0x9,%al
ja     1130 <zwavecmd_association_remove+0x20>
movzbl %cl,%eax
lea    (%r9,%r9,4),%ecx
lea    (%rax,%rcx,2),%r9d
add    $0xffffffd0,%r9d
jmp    113e <zwavecmd_association_remove+0x2e>
xor    %r9d,%r9d
mov    %sil,(%rsp)
mov    %r9b,0x1(%rsp)
mov    %rsp,%rcx
mov    $0x85,%esi
mov    $0x4,%edx
mov    $0x2,%r8d
call   1030 <zwave_sendClassCommand@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
define void @zwavecmd_association_remove(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [255 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %9
%10 = load i8*, i8** %6
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %47
13: ; preds = %3
br label %14
14: ; preds = %43, %13
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %46
18: ; preds = %14
%19 = load i8*, i8** %6
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %36
23: ; preds = %18
%24 = load i8*, i8** %6
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 57
br i1 %27, label %28, label %36
28: ; preds = %23
%29 = load i32, i32* %9
%30 = mul nsw i32 %29, 10
%31 = load i8*, i8** %6
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = add nsw i32 %30, %34
store i32 %35, i32* %9
br label %43
36: ; preds = %23, %18
%37 = load i32, i32* %9
%38 = trunc i32 %37 to i8
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %41
store i8 %38, i8* %42
store i32 0, i32* %9
br label %43
43: ; preds = %36, %28
%44 = load i8*, i8** %6
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %6
br label %14
46: ; preds = %14
br label %47
47: ; preds = %46, %3
%48 = load i32, i32* %5
%49 = trunc i32 %48 to i8
%50 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
store i8 %49, i8* %50
%51 = load i32, i32* %9
%52 = trunc i32 %51 to i8
%53 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 1
store i8 %52, i8* %53
store i32 2, i32* %8
%54 = load i32, i32* %4
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%56 = load i32, i32* %8
%57 = call i32 @zwave_sendClassCommand(i32 %54, i32 133, i32 4, i8* %55, i32 %56)
ret void
}

LLVM IR (-O2):
define void @zwavecmd_association_remove(i32 %0, i32 %1, i8* nocapture %2) {
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %31, label %8
8: ; preds = %3, %25
%9 = phi i32 [ %27, %25 ], [ 0, %3 ]
%10 = phi i32 [ %26, %25 ], [ undef, %3 ]
%11 = phi i8* [ %28, %25 ], [ %2, %3 ]
%12 = phi i8 [ %29, %25 ], [ %6, %3 ]
%13 = add i8 %12, -48
%14 = icmp ult i8 %13, 10
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = zext i8 %12 to i32
%17 = mul i32 %9, 10
%18 = add nsw i32 %16, -48
%19 = add i32 %18, %17
br label %25
20: ; preds = %8
%21 = trunc i32 %9 to i8
%22 = add nsw i32 %10, 1
%23 = sext i32 %10 to i64
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 %23
store i8 %21, i8* %24
br label %25
25: ; preds = %20, %15
%26 = phi i32 [ %10, %15 ], [ %22, %20 ]
%27 = phi i32 [ %19, %15 ], [ 0, %20 ]
%28 = getelementptr inbounds i8, i8* %11, i64 1
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %8
31: ; preds = %25, %3
%32 = phi i32 [ 0, %3 ], [ %27, %25 ]
%33 = trunc i32 %1 to i8
store i8 %33, i8* %5
%34 = trunc i32 %32 to i8
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 1
store i8 %34, i8* %35
%36 = call i32 @zwave_sendClassCommand(i32 %0, i32 133, i32 4, i8* %5, i32 2)
ret void
}