#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*/ printf(char *, ...);
void show_cell(double lattice[3][3], double position[][3], const int types[],
               const int num_atom) {
  int i;
  printf("Lattice parameter:\n");
  for (i = 0; i < 3; i++) {
    printf("%f %f %f\n", lattice[0][i], lattice[1][i], lattice[2][i]);
  }
  printf("Atomic positions:\n");
  for (i = 0; i < num_atom; i++) {
    printf("%d: %f %f %f\n", types[i], position[i][0], position[i][1],
           position[i][2]);
  }
}


x86 assembly (clang, -O0):
<show_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    118b <show_cell+0x7b>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  0x18(%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  0x30(%rax,%rcx,8),%xmm2
lea    0xeb5(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113c <show_cell+0x2c>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    120e <show_cell+0xfe>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xe2e(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a0 <show_cell+0x90>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_cell>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
movsd  0x0(%rbp),%xmm0
movsd  0x18(%rbp),%xmm1
movsd  0x30(%rbp),%xmm2
lea    0xeae(%rip),%r12
mov    %r12,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x8(%rbp),%xmm0
movsd  0x20(%rbp),%xmm1
movsd  0x38(%rbp),%xmm2
mov    %r12,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x10(%rbp),%xmm0
movsd  0x28(%rbp),%xmm1
movsd  0x40(%rbp),%xmm2
mov    %r12,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
test   %r15d,%r15d
jle    11e9 <show_cell+0xc9>
mov    %r15d,%r12d
add    $0x10,%rbx
xor    %ebp,%ebp
lea    0xe4d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbp,4),%esi
movsd  -0x10(%rbx),%xmm0
movsd  -0x8(%rbx),%xmm1
movsd  (%rbx),%xmm2
mov    %r15,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x1,%rbp
add    $0x18,%rbx
cmp    %rbp,%r12
jne    11c0 <show_cell+0xa0>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Lattice parameter:\0A\00"
@.str.1 = [10 x i8] c"%f %f %f\0A\00"
@.str.2 = [19 x i8] c"Atomic positions:\0A\00"
@.str.3 = [14 x i8] c"%d: %f %f %f\0A\00"
define void @show_cell([3 x double]* %0, [3 x double]* %1, i32* %2, i32 %3) {
%5 = alloca [3 x double]*
%6 = alloca [3 x double]*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store [3 x double]* %0, [3 x double]** %5
store [3 x double]* %1, [3 x double]** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %11
11: ; preds = %34, %4
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %37
14: ; preds = %11
%15 = load [3 x double]*, [3 x double]** %5
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 %18
%20 = load double, double* %19
%21 = load [3 x double]*, [3 x double]** %5
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 1
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %24
%26 = load double, double* %25
%27 = load [3 x double]*, [3 x double]** %5
%28 = getelementptr inbounds [3 x double], [3 x double]* %27, i64 2
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [3 x double], [3 x double]* %28, i64 0, i64 %30
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %20, double %26, double %32)
br label %34
34: ; preds = %14
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %11
37: ; preds = %11
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %9
br label %39
39: ; preds = %68, %37
%40 = load i32, i32* %9
%41 = load i32, i32* %8
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %71
43: ; preds = %39
%44 = load i32*, i32** %7
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
%49 = load [3 x double]*, [3 x double]** %6
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 %51
%53 = getelementptr inbounds [3 x double], [3 x double]* %52, i64 0, i64 0
%54 = load double, double* %53
%55 = load [3 x double]*, [3 x double]** %6
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x double], [3 x double]* %55, i64 %57
%59 = getelementptr inbounds [3 x double], [3 x double]* %58, i64 0, i64 1
%60 = load double, double* %59
%61 = load [3 x double]*, [3 x double]** %6
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %63
%65 = getelementptr inbounds [3 x double], [3 x double]* %64, i64 0, i64 2
%66 = load double, double* %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %48, double %54, double %60, double %66)
br label %68
68: ; preds = %43
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
br label %39
71: ; preds = %39
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"%f %f %f\0A\00"
@.str.3 = [14 x i8] c"%d: %f %f %f\0A\00"
@str = [19 x i8] c"Lattice parameter:\00"
@str.4 = [18 x i8] c"Atomic positions:\00"
define void @show_cell([3 x double]* nocapture %0, [3 x double]* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%7 = load double, double* %6
%8 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%9 = load double, double* %8
%10 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%11 = load double, double* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %7, double %9, double %11)
%13 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%14 = load double, double* %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
%18 = load double, double* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %14, double %16, double %18)
%20 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%21 = load double, double* %20
%22 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%23 = load double, double* %22
%24 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%25 = load double, double* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %21, double %23, double %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
%28 = icmp sgt i32 %3, 0
br i1 %28, label %29, label %44
29: ; preds = %4
%30 = zext i32 %3 to i64
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ 0, %29 ], [ %42, %31 ]
%33 = getelementptr inbounds i32, i32* %2, i64 %32
%34 = load i32, i32* %33
%35 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %32, i64 0
%36 = load double, double* %35
%37 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %32, i64 1
%38 = load double, double* %37
%39 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %32, i64 2
%40 = load double, double* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %34, double %36, double %38, double %40)
%42 = add nuw nsw i64 %32, 1
%43 = icmp eq i64 %42, %30
br i1 %43, label %44, label %31
44: ; preds = %31, %4
ret void
}