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


x86 assembly (clang, -O0):
<rgd_get_double_grid_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x3,-0x28(%rbp)
jge    1182 <rgd_get_double_grid_address+0x72>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
shl    $0x1,%rdx
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
setne  %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1130 <rgd_get_double_grid_address+0x20>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <reduce_double_grid_address@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgd_get_double_grid_address>:
mov    (%rsi),%r8
xor    %eax,%eax
cmpq   $0x0,(%rcx)
setne  %al
lea    (%rax,%r8,2),%rax
mov    %rax,(%rdi)
mov    0x8(%rsi),%r8
xor    %eax,%eax
cmpq   $0x0,0x8(%rcx)
setne  %al
lea    (%rax,%r8,2),%rax
mov    %rax,0x8(%rdi)
xor    %eax,%eax
cmpq   $0x0,0x10(%rcx)
mov    0x10(%rsi),%rcx
setne  %al
lea    (%rax,%rcx,2),%rax
mov    %rax,0x10(%rdi)
mov    %rdx,%rsi
jmp    1030 <reduce_double_grid_address@plt>

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

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