#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 atoi(char *);
int /*<<< orphan*/ zwave_sendClassCommand(unsigned int, int, int,
                                          unsigned char *, int);
void zwavecmd_proprietary_set_raw(unsigned int id, char *args[]) {
  unsigned char buf[256];
  int i;
  for (i = 0; args[i]; i++) {
    buf[i] = atoi(args[i]);
  }
  zwave_sendClassCommand(id, 0x88, 0x01, buf, i);
}


x86 assembly (clang, -O0):
<zwavecmd_proprietary_set_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x114(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     118a <zwavecmd_proprietary_set_raw+0x6a>
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atoi@plt>
mov    %al,%cl
movslq -0x114(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    113c <zwavecmd_proprietary_set_raw+0x1c>
mov    -0x4(%rbp),%edi
lea    -0x110(%rbp),%rcx
mov    -0x114(%rbp),%r8d
mov    $0x88,%esi
mov    $0x1,%edx
call   1030 <zwave_sendClassCommand@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zwavecmd_proprietary_set_raw>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %edi,%r14d
mov    (%rsi),%rdi
test   %rdi,%rdi
je     1158 <zwavecmd_proprietary_set_raw+0x38>
mov    %rsi,%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
call   1040 <atoi@plt>
mov    %al,(%rsp,%rbx,1)
mov    0x8(%rbp,%rbx,8),%rdi
add    $0x1,%rbx
test   %rdi,%rdi
jne    1140 <zwavecmd_proprietary_set_raw+0x20>
jmp    115a <zwavecmd_proprietary_set_raw+0x3a>
xor    %ebx,%ebx
mov    %rsp,%rcx
mov    %r14d,%edi
mov    $0x88,%esi
mov    $0x1,%edx
mov    %ebx,%r8d
call   1030 <zwave_sendClassCommand@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @zwavecmd_proprietary_set_raw(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [256 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %6
br label %7
7: ; preds = %24, %2
%8 = load i8**, i8*** %4
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %27
14: ; preds = %7
%15 = load i8**, i8*** %4
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call zeroext i8 @atoi(i8* %19)
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %14
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %7
27: ; preds = %7
%28 = load i32, i32* %3
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%30 = load i32, i32* %6
%31 = call i32 @zwave_sendClassCommand(i32 %28, i32 136, i32 1, i8* %29, i32 %30)
ret void
}

LLVM IR (-O2):
define void @zwavecmd_proprietary_set_raw(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %18, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %12, %7 ], [ 0, %2 ]
%9 = phi i8* [ %14, %7 ], [ %5, %2 ]
%10 = tail call zeroext i8 @atoi(i8* %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %8
store i8 %10, i8* %11
%12 = add nuw nsw i64 %8, 1
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %7
16: ; preds = %7
%17 = trunc i64 %12 to i32
br label %18
18: ; preds = %16, %2
%19 = phi i32 [ 0, %2 ], [ %17, %16 ]
%20 = call i32 @zwave_sendClassCommand(i32 %0, i32 136, i32 1, i8* %4, i32 %19)
ret void
}