#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 */
double fabs(double);
int /*<<< orphan*/ printf(char *);
int set_origin_get_mode(int nxstart, int nystart, int nzstart, double widthx,
                        double widthy, double widthz, double xorigin,
                        double yorigin, double zorigin, double *origx,
                        double *origy, double *origz) {
  if (fabs(xorigin) < 0.0001 && fabs(yorigin) < 0.0001 &&
      fabs(zorigin) < 0.0001) {
    printf("lib_vio> Using crystallographic (CCP4) style origin defined by "
           "unit cell start indices.\n");
    *origx = nxstart * widthx;
    *origy = nystart * widthy;
    *origz = nzstart * widthz;
    return 0;
  } else {
    printf("lib_vio> Using MRC2000 style origin defined by [X,Y,Z]ORIGIN "
           "fields.\n");
    *origx = xorigin;
    *origy = yorigin;
    *origz = zorigin;
    return 1;
  }
}


x86 assembly (clang, -O0):
<set_origin_get_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  %xmm5,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm1
movaps 0xeb9(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe9d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ff <set_origin_get_mode+0xef>
movsd  -0x38(%rbp),%xmm1
movaps 0xe97(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe7b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ff <set_origin_get_mode+0xef>
movsd  -0x40(%rbp),%xmm1
movaps 0xe75(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe59(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ff <set_origin_get_mode+0xef>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
cvtsi2sdl -0xc(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
cvtsi2sdl -0x10(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1239 <set_origin_get_mode+0x129>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_origin_get_mode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%rbx
movapd 0xed1(%rip),%xmm6
movapd %xmm3,%xmm7
andpd  %xmm6,%xmm7
movsd  0xed0(%rip),%xmm8
ucomisd %xmm7,%xmm8
jbe    11bb <set_origin_get_mode+0xab>
movapd %xmm4,%xmm7
andpd  %xmm6,%xmm7
ucomisd %xmm7,%xmm8
jbe    11bb <set_origin_get_mode+0xab>
andpd  %xmm5,%xmm6
ucomisd %xmm6,%xmm8
jbe    11bb <set_origin_get_mode+0xab>
mov    %edx,%r12d
mov    %esi,%r13d
mov    %edi,%ebp
lea    0xeed(%rip),%rdi
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r15)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mulsd  0x20(%rsp),%xmm0
xor    %eax,%eax
jmp    11f5 <set_origin_get_mode+0xe5>
lea    0xe56(%rip),%rdi
movapd %xmm5,0x20(%rsp)
movapd %xmm4,0x10(%rsp)
movapd %xmm3,(%rsp)
call   1030 <puts@plt>
movapd 0x20(%rsp),%xmm0
movaps (%rsp),%xmm1
movsd  %xmm1,(%rbx)
movaps 0x10(%rsp),%xmm1
movsd  %xmm1,(%r15)
mov    $0x1,%eax
movsd  %xmm0,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [89 x i8] c"lib_vio> Using crystallographic (CCP4) style origin defined by unit cell start indices.\0A\00"
@.str.1 = [70 x i8] c"lib_vio> Using MRC2000 style origin defined by [X,Y,Z]ORIGIN fields.\0A\00"
define i32 @set_origin_get_mode(i32 %0, i32 %1, i32 %2, double %3, double %4, double %5, double %6, double %7, double %8, double* %9, double* %10, double* %11) {
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double*
%24 = alloca double*
%25 = alloca double*
store i32 %0, i32* %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store double %3, double* %17
store double %4, double* %18
store double %5, double* %19
store double %6, double* %20
store double %7, double* %21
store double %8, double* %22
store double* %9, double** %23
store double* %10, double** %24
store double* %11, double** %25
%26 = load double, double* %20
%27 = call double @llvm.fabs.f64(double %26)
%28 = fcmp olt double %27, 1.000000e-04
br i1 %28, label %29, label %54
29: ; preds = %12
%30 = load double, double* %21
%31 = call double @llvm.fabs.f64(double %30)
%32 = fcmp olt double %31, 1.000000e-04
br i1 %32, label %33, label %54
33: ; preds = %29
%34 = load double, double* %22
%35 = call double @llvm.fabs.f64(double %34)
%36 = fcmp olt double %35, 1.000000e-04
br i1 %36, label %37, label %54
37: ; preds = %33
%38 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
%39 = load i32, i32* %14
%40 = sitofp i32 %39 to double
%41 = load double, double* %17
%42 = fmul double %40, %41
%43 = load double*, double** %23
store double %42, double* %43
%44 = load i32, i32* %15
%45 = sitofp i32 %44 to double
%46 = load double, double* %18
%47 = fmul double %45, %46
%48 = load double*, double** %24
store double %47, double* %48
%49 = load i32, i32* %16
%50 = sitofp i32 %49 to double
%51 = load double, double* %19
%52 = fmul double %50, %51
%53 = load double*, double** %25
store double %52, double* %53
store i32 0, i32* %13
br label %62
54: ; preds = %33, %29, %12
%55 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
%56 = load double, double* %20
%57 = load double*, double** %23
store double %56, double* %57
%58 = load double, double* %21
%59 = load double*, double** %24
store double %58, double* %59
%60 = load double, double* %22
%61 = load double*, double** %25
store double %60, double* %61
store i32 1, i32* %13
br label %62
62: ; preds = %54, %37
%63 = load i32, i32* %13
ret i32 %63
}

LLVM IR (-O2):
@str = [69 x i8] c"lib_vio> Using MRC2000 style origin defined by [X,Y,Z]ORIGIN fields.\00"
@str.2 = [88 x i8] c"lib_vio> Using crystallographic (CCP4) style origin defined by unit cell start indices.\00"
define i32 @set_origin_get_mode(i32 %0, i32 %1, i32 %2, double %3, double %4, double %5, double %6, double %7, double %8, double* nocapture writeonly %9, double* nocapture writeonly %10, double* nocapture writeonly %11) {
%13 = tail call double @llvm.fabs.f64(double %6)
%14 = fcmp olt double %13, 1.000000e-04
%15 = tail call double @llvm.fabs.f64(double %7)
%16 = fcmp olt double %15, 1.000000e-04
%17 = select i1 %14, i1 %16, i1 false
%18 = tail call double @llvm.fabs.f64(double %8)
%19 = fcmp olt double %18, 1.000000e-04
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %21, label %29
21: ; preds = %12
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @str.2, i64 0, i64 0))
%23 = sitofp i32 %0 to double
%24 = fmul double %23, %3
store double %24, double* %9
%25 = sitofp i32 %1 to double
%26 = fmul double %25, %4
store double %26, double* %10
%27 = sitofp i32 %2 to double
%28 = fmul double %27, %5
br label %31
29: ; preds = %12
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
store double %6, double* %9
store double %7, double* %10
br label %31
31: ; preds = %29, %21
%32 = phi double [ %8, %29 ], [ %28, %21 ]
%33 = phi i32 [ 1, %29 ], [ 0, %21 ]
store double %32, double* %11
ret i32 %33
}