#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 Get_value_at_indices(void *self, const char *name, void *dest, int *inds,
                         int len) {
  int status = (0);
  void *src = 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, &src);
    if (status == (1))
      return status;
    {
      int i;
      int offset;
      void *ptr;
      for (i = 0, ptr = dest; i < len; i++, ptr += itemsize) {
        offset = inds[i] * itemsize;
        memcpy(ptr, src + offset, itemsize);
      }
    }
  }
  return status;
}


x86 assembly (clang, -O0):
<Get_value_at_indices>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x8,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1196 <Get_value_at_indices+0x66>
mov    -0x18(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1223 <Get_value_at_indices+0xf3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <Get_value_ptr@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    11bf <Get_value_at_indices+0x8f>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1229 <Get_value_at_indices+0xf9>
movl   $0x0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    121e <Get_value_at_indices+0xee>
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x3,%eax
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rsi
movslq -0x44(%rbp),%rax
add    %rax,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x50(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x50(%rbp)
jmp    11ce <Get_value_at_indices+0x9e>
jmp    1223 <Get_value_at_indices+0xf3>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_value_at_indices>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8d,%r15d
mov    %rcx,%r14
mov    %rdx,%rbx
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 <Get_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 <Get_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 <Get_value_at_indices+0xaa>
test   %r15d,%r15d
jle    11d7 <Get_value_at_indices+0xa7>
mov    %r15d,%r15d
xor    %ebp,%ebp
nopl   0x0(%rax)
movslq (%r14,%rbp,4),%rsi
shl    $0x3,%rsi
add    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
add    $0x1,%rbp
add    $0x8,%rbx
cmp    %rbp,%r15
jne    11b0 <Get_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 @Get_value_at_indices(i8* %0, i8* %1, i8* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%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 i8* %2, i8** %9
store i32* %3, i32** %10
store i32 %4, i32* %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** %9
store i8* %34, i8** %17
br label %35
35: ; preds = %52, %33
%36 = load i32, i32* %15
%37 = load i32, i32* %11
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %57
39: ; preds = %35
%40 = load i32*, i32** %10
%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** %17
%47 = load i8*, i8** %13
%48 = load i32, i32* %16
%49 = sext i32 %48 to i64
%50 = getelementptr i8, i8* %47, i64 %49
%51 = call i32 @memcpy(i8* %46, 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 @Get_value_at_indices(i8* %0, i8* %1, i8* %2, i32* nocapture %3, i32 %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 %4, 0
br i1 %17, label %18, label %33
18: ; preds = %16
%19 = zext i32 %4 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %30, %20 ]
%22 = phi i8* [ %2, %18 ], [ %31, %20 ]
%23 = getelementptr inbounds i32, i32* %3, 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* %22, i8* %28, 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
}