#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 Get_value_ptr(void *, char const *, void **);
int /*<<< orphan*/ memcpy(void *, void *, int const);
scalar_t__ strcmp(char const *, char *);
int Set_value_at_indices(void *self, const char *name, int *inds, int len,
                         void *src) {
  int status = (0);
  void *to = NULL;
  const int itemsize = sizeof(double);
  if ((strcmp(name, "atmosphere_air_flow__east_component_of_velocity") == 0) ||
      (strcmp(name, "atmosphere_air_flow__north_component_of_velocity") == 0)) {
    status = Get_value_ptr(self, name, &to);
    if (status == (1))
      return status;
    {
      int i;
      int offset;
      void *ptr;
      for (i = 0, ptr = src; i < len; i++, ptr += itemsize) {
        offset = inds[i] * itemsize;
        memcpy(to + offset, ptr, itemsize);
      }
    }
  }
  return status;
}


x86 assembly (clang, -O0):
<Set_value_at_indices>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x8,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1195 <Set_value_at_indices+0x65>
mov    -0x18(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1222 <Set_value_at_indices+0xf2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1050 <Get_value_ptr@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    11be <Set_value_at_indices+0x8e>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1228 <Set_value_at_indices+0xf8>
movl   $0x0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    121d <Set_value_at_indices+0xed>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x3,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%rdi
movslq -0x4c(%rbp),%rax
add    %rax,%rdi
mov    -0x58(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x58(%rbp)
jmp    11cd <Set_value_at_indices+0x9d>
jmp    1222 <Set_value_at_indices+0xf2>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set_value_at_indices>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%rbx
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %rdi,%r12
movq   $0x0,0x8(%rsp)
lea    0xea5(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1181 <Set_value_at_indices+0x51>
lea    0xec1(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    11da <Set_value_at_indices+0xaa>
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <Get_value_ptr@plt>
mov    %eax,%r12d
mov    $0x1,%eax
cmp    $0x1,%r12d
je     11da <Set_value_at_indices+0xaa>
test   %r15d,%r15d
jle    11d7 <Set_value_at_indices+0xa7>
mov    %r15d,%r15d
xor    %ebp,%ebp
nopl   0x0(%rax)
movslq (%r14,%rbp,4),%rdi
shl    $0x3,%rdi
add    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
add    $0x1,%rbp
add    $0x8,%rbx
cmp    %rbp,%r15
jne    11b0 <Set_value_at_indices+0x80>
mov    %r12d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"atmosphere_air_flow__east_component_of_velocity\00"
@.str.1 = [49 x i8] c"atmosphere_air_flow__north_component_of_velocity\00"
define i32 @Set_value_at_indices(i8* %0, i8* %1, i32* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 0, i32* %12
store i8* null, i8** %13
store i32 8, i32* %14
%18 = load i8*, i8** %8
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %5
%22 = load i8*, i8** %8
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %58
25: ; preds = %21, %5
%26 = load i8*, i8** %7
%27 = load i8*, i8** %8
%28 = call i32 @Get_value_ptr(i8* %26, i8* %27, i8** %13)
store i32 %28, i32* %12
%29 = load i32, i32* %12
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = load i32, i32* %12
store i32 %32, i32* %6
br label %60
33: ; preds = %25
store i32 0, i32* %15
%34 = load i8*, i8** %11
store i8* %34, i8** %17
br label %35
35: ; preds = %52, %33
%36 = load i32, i32* %15
%37 = load i32, i32* %10
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %57
39: ; preds = %35
%40 = load i32*, i32** %9
%41 = load i32, i32* %15
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = mul nsw i32 %44, 8
store i32 %45, i32* %16
%46 = load i8*, i8** %13
%47 = load i32, i32* %16
%48 = sext i32 %47 to i64
%49 = getelementptr i8, i8* %46, i64 %48
%50 = load i8*, i8** %17
%51 = call i32 @memcpy(i8* %49, i8* %50, i32 8)
br label %52
52: ; preds = %39
%53 = load i32, i32* %15
%54 = add nsw i32 %53, 1
store i32 %54, i32* %15
%55 = load i8*, i8** %17
%56 = getelementptr i8, i8* %55, i64 8
store i8* %56, i8** %17
br label %35
57: ; preds = %35
br label %58
58: ; preds = %57, %21
%59 = load i32, i32* %12
store i32 %59, i32* %6
br label %60
60: ; preds = %58, %31
%61 = load i32, i32* %6
ret i32 %61
}

LLVM IR (-O2):
@.str = [48 x i8] c"atmosphere_air_flow__east_component_of_velocity\00"
@.str.1 = [49 x i8] c"atmosphere_air_flow__north_component_of_velocity\00"
define i32 @Set_value_at_indices(i8* %0, i8* %1, i32* nocapture %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = bitcast i8** %6 to i8*
store i8* null, i8** %6
%8 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %33
13: ; preds = %10, %5
%14 = call i32 @Get_value_ptr(i8* %0, i8* %1, i8** %6)
%15 = icmp eq i32 %14, 1
br i1 %15, label %33, label %16
16: ; preds = %13
%17 = icmp sgt i32 %3, 0
br i1 %17, label %18, label %33
18: ; preds = %16
%19 = zext i32 %3 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %30, %20 ]
%22 = phi i8* [ %4, %18 ], [ %31, %20 ]
%23 = getelementptr inbounds i32, i32* %2, i64 %21
%24 = load i32, i32* %23
%25 = shl nsw i32 %24, 3
%26 = load i8*, i8** %6
%27 = sext i32 %25 to i64
%28 = getelementptr i8, i8* %26, i64 %27
%29 = call i32 @memcpy(i8* %28, i8* %22, i32 8)
%30 = add nuw nsw i64 %21, 1
%31 = getelementptr i8, i8* %22, i64 8
%32 = icmp eq i64 %30, %19
br i1 %32, label %33, label %20
33: ; preds = %20, %16, %10, %13
%34 = phi i32 [ 1, %13 ], [ 0, %10 ], [ %14, %16 ], [ %14, %20 ]
ret i32 %34
}