#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*/ reduce_grid_address_double(int *, int const *);
void kgd_get_grid_address_double_mesh(int address_double[3],
                                      const int address[3], const int mesh[3],
                                      const int is_shift[3]) {
  int i;
  for (i = 0; i < 3; i++) {
    address_double[i] = address[i] * 2 + (is_shift[i] != 0);
  }
  reduce_grid_address_double(address_double, mesh);
}


x86 assembly (clang, -O0):
<kgd_get_grid_address_double_mesh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1176 <kgd_get_grid_address_double_mesh+0x66>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
shl    $0x1,%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <kgd_get_grid_address_double_mesh+0x1f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <reduce_grid_address_double@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kgd_get_grid_address_double_mesh>:
mov    (%rsi),%r8d
xor    %eax,%eax
cmpl   $0x0,(%rcx)
setne  %al
lea    (%rax,%r8,2),%eax
mov    %eax,(%rdi)
mov    0x4(%rsi),%r8d
xor    %eax,%eax
cmpl   $0x0,0x4(%rcx)
setne  %al
lea    (%rax,%r8,2),%eax
mov    %eax,0x4(%rdi)
xor    %eax,%eax
cmpl   $0x0,0x8(%rcx)
mov    0x8(%rsi),%ecx
setne  %al
lea    (%rax,%rcx,2),%eax
mov    %eax,0x8(%rdi)
mov    %rdx,%rsi
jmp    1030 <reduce_grid_address_double@plt>

LLVM IR (-O0):
define void @kgd_get_grid_address_double_mesh(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
store i32 0, i32* %9
br label %10
10: ; preds = %32, %4
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = load i32*, i32** %6
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = mul nsw i32 %18, 2
%20 = load i32*, i32** %8
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i32
%27 = add nsw i32 %19, %26
%28 = load i32*, i32** %5
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
br label %32
32: ; preds = %13
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %10
35: ; preds = %10
%36 = load i32*, i32** %5
%37 = load i32*, i32** %7
%38 = call i32 @reduce_grid_address_double(i32* %36, i32* %37)
ret void
}

LLVM IR (-O2):
define void @kgd_get_grid_address_double_mesh(i32* %0, i32* nocapture %1, i32* %2, i32* nocapture %3) {
%5 = load i32, i32* %1
%6 = shl nsw i32 %5, 1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
%10 = or i32 %6, %9
store i32 %10, i32* %0
%11 = getelementptr inbounds i32, i32* %1, i64 1
%12 = load i32, i32* %11
%13 = shl nsw i32 %12, 1
%14 = getelementptr inbounds i32, i32* %3, i64 1
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = or i32 %13, %17
%19 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %18, i32* %19
%20 = getelementptr inbounds i32, i32* %1, i64 2
%21 = load i32, i32* %20
%22 = shl nsw i32 %21, 1
%23 = getelementptr inbounds i32, i32* %3, i64 2
%24 = load i32, i32* %23
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i32
%27 = or i32 %22, %26
%28 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %27, i32* %28
%29 = tail call i32 @reduce_grid_address_double(i32* %0, i32* %2)
ret void
}