#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 cross_product_of_vectors(int str_a[], int str_b[]) {
  int result[3];
  int i = 3 - 3, f = 3 - 2, g = 3 - 1;
  result[0] = (str_a[f] * str_b[g]) - (str_a[g] * str_b[f]);
  result[1] = (str_a[g] * str_b[i]) - (str_a[i] * str_b[g]);
  result[2] = (str_a[i] * str_b[f]) - (str_a[f] * str_b[i]);
  printf("Printing result:");
  printf("[");
  int k;
  for (k = 0; k < 3; k++) {
    printf("%d", result[k]);
    if (k < 3 - 1) {
      printf(", ");
    }
  }
  printf("]");
}


x86 assembly (clang, -O0):
<cross_product_of_vectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x28(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x28(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    -0x10(%rbp),%rdx
movslq -0x24(%rbp),%rsi
imul   (%rdx,%rsi,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x20(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    -0x10(%rbp),%rdx
movslq -0x28(%rbp),%rsi
imul   (%rdx,%rsi,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    -0x10(%rbp),%rdx
movslq -0x20(%rbp),%rsi
imul   (%rdx,%rsi,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    123c <cross_product_of_vectors+0x12c>
movslq -0x2c(%rbp),%rax
mov    -0x1c(%rbp,%rax,4),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x2c(%rbp)
jge    1229 <cross_product_of_vectors+0x119>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122e <cross_product_of_vectors+0x11e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f1 <cross_product_of_vectors+0xe1>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cross_product_of_vectors>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%r14d
mov    0x4(%rdi),%eax
mov    0x8(%rsi),%ecx
mov    %ecx,%ebx
imul   %eax,%ebx
mov    0x8(%rdi),%ebp
mov    (%rsi),%edx
mov    0x4(%rsi),%esi
imul   %r14d,%ecx
imul   %esi,%r14d
imul   %ebp,%esi
sub    %esi,%ebx
imul   %edx,%ebp
sub    %ecx,%ebp
imul   %eax,%edx
sub    %edx,%r14d
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5b,%edi
call   1030 <putchar@plt>
lea    0xe9d(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8d(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Printing result:\00"
@.str.1 = [2 x i8] c"[\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [2 x i8] c"]\00"
define void @cross_product_of_vectors(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [3 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %6
store i32 1, i32* %7
store i32 2, i32* %8
%10 = load i32*, i32** %3
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = load i32*, i32** %4
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = mul nsw i32 %14, %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = load i32*, i32** %4
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = mul nsw i32 %25, %30
%32 = sub nsw i32 %20, %31
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
store i32 %32, i32* %33
%34 = load i32*, i32** %3
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = load i32*, i32** %4
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
%44 = mul nsw i32 %38, %43
%45 = load i32*, i32** %3
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = load i32, i32* %48
%50 = load i32*, i32** %4
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
%54 = load i32, i32* %53
%55 = mul nsw i32 %49, %54
%56 = sub nsw i32 %44, %55
%57 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
store i32 %56, i32* %57
%58 = load i32*, i32** %3
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = load i32*, i32** %4
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = mul nsw i32 %62, %67
%69 = load i32*, i32** %3
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %69, i64 %71
%73 = load i32, i32* %72
%74 = load i32*, i32** %4
%75 = load i32, i32* %6
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = load i32, i32* %77
%79 = mul nsw i32 %73, %78
%80 = sub nsw i32 %68, %79
%81 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
store i32 %80, i32* %81
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %9
br label %84
84: ; preds = %98, %2
%85 = load i32, i32* %9
%86 = icmp slt i32 %85, 3
br i1 %86, label %87, label %101
87: ; preds = %84
%88 = load i32, i32* %9
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %91)
%93 = load i32, i32* %9
%94 = icmp slt i32 %93, 2
br i1 %94, label %95, label %97
95: ; preds = %87
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %97
97: ; preds = %95, %87
br label %98
98: ; preds = %97
%99 = load i32, i32* %9
%100 = add nsw i32 %99, 1
store i32 %100, i32* %9
br label %84
101: ; preds = %84
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Printing result:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c", \00"
define void @cross_product_of_vectors(i32* nocapture %0, i32* nocapture %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds i32, i32* %1, i64 2
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, %4
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %1, i64 1
%11 = load i32, i32* %10
%12 = mul nsw i32 %11, %9
%13 = sub nsw i32 %7, %12
%14 = load i32, i32* %1
%15 = mul nsw i32 %14, %9
%16 = load i32, i32* %0
%17 = mul nsw i32 %16, %6
%18 = sub nsw i32 %15, %17
%19 = mul nsw i32 %16, %11
%20 = mul nsw i32 %14, %4
%21 = sub nsw i32 %19, %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 @putchar(i32 91)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%29 = tail call i32 @putchar(i32 93)
ret void
}