#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 letraCoeficiente(int);
int /*<<< orphan*/ mostrarResultado(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
void subtracao() {
  int i = 0, j, vet[3] = {0, 0, 0};
  int vetResult[3] = {0, 0, 0};
  int op = 1;
  system("clear");
  while (op) {
    if (i == 0) {
      printf("--vetor %d---\n", i + 1);
      for (j = 0; j < 3; j++) {
        printf("Informe o coeficiente de %c: ", letraCoeficiente(j));
        scanf("%d", &vetResult[j]);
      }
    } else {
      printf("---vetor %d---\n", i + 1);
      for (j = 0; j < 3; j++) {
        printf("Informe o coeficiente de %c: ", letraCoeficiente(j));
        scanf("%d", &vet[j]);
        vetResult[j] -= vet[j];
      }
    }
    i++;
    if (i > 1) {
      printf("Deseja informar outro vetor? (1 - Sim / 0 - Nao): ");
      scanf("%d", &op);
    }
    system("clear");
  }
  printf("---Vetor resultante (subtracao)---\n");
  mostrarResultado(vetResult);
}


x86 assembly (clang, -O0):
<subtracao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
movl   $0x1,-0x24(%rbp)
lea    0xe63(%rip),%rdi
call   1030 <system@plt>
cmpl   $0x0,-0x24(%rbp)
je     12e4 <subtracao+0x184>
cmpl   $0x0,-0x4(%rbp)
jne    1221 <subtracao+0xc1>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    121c <subtracao+0xbc>
mov    -0x8(%rbp),%edi
call   1060 <letraCoeficiente@plt>
mov    %eax,%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe1b(%rip),%rdi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <subtracao+0x71>
jmp    12a2 <subtracao+0x142>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    129d <subtracao+0x13d>
mov    -0x8(%rbp),%edi
call   1060 <letraCoeficiente@plt>
mov    %eax,%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x14(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdb0(%rip),%rdi
call   1080 <scanf@plt>
movslq -0x8(%rbp),%rax
mov    -0x14(%rbp,%rax,4),%edx
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
sub    %edx,%ecx
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    123c <subtracao+0xdc>
jmp    12a2 <subtracao+0x142>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    12d3 <subtracao+0x173>
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd5a(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1080 <scanf@plt>
lea    0xd26(%rip),%rdi
call   1030 <system@plt>
jmp    11a2 <subtracao+0x42>
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1070 <mostrarResultado@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subtracao>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movl   $0x1,0x14(%rsp)
lea    0xe61(%rip),%rbx
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe58(%rip),%rbp
lea    0xe6f(%rip),%r12
lea    0xe7b(%rip),%r15
lea    0x14(%rsp),%r14
xor    %r13d,%r13d
jmp    1262 <subtracao+0x102>
nopl   0x0(%rax)
mov    $0x1,%r13d
lea    0xe4b(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1060 <letraCoeficiente@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
lea    0x8(%rsp),%rsi
call   1080 <scanf@plt>
mov    $0x1,%edi
call   1060 <letraCoeficiente@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    $0x2,%edi
call   1060 <letraCoeficiente@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r12,%rdi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
cmpl   $0x0,0x14(%rsp)
je     1310 <subtracao+0x1b0>
test   %r13d,%r13d
je     11d0 <subtracao+0x70>
add    $0x1,%r13d
lea    0xdb1(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1060 <letraCoeficiente@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
lea    0x18(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x18(%rsp),%eax
sub    %eax,0x8(%rsp)
mov    $0x1,%edi
call   1060 <letraCoeficiente@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
lea    0x1c(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x1c(%rsp),%eax
sub    %eax,0xc(%rsp)
mov    $0x2,%edi
call   1060 <letraCoeficiente@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
lea    0x20(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x20(%rsp),%eax
sub    %eax,0x10(%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rsi
jmp    1247 <subtracao+0xe7>
lea    0xd53(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rdi
call   1070 <mostrarResultado@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [15 x i8] c"--vetor %d---\0A\00"
@.str.2 = [30 x i8] c"Informe o coeficiente de %c: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"---vetor %d---\0A\00"
@.str.5 = [51 x i8] c"Deseja informar outro vetor? (1 - Sim / 0 - Nao): \00"
@.str.6 = [36 x i8] c"---Vetor resultante (subtracao)---\0A\00"
define void @subtracao() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = alloca [3 x i32]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [3 x i32]* %3 to i8*
%7 = bitcast [3 x i32]* %4 to i8*
store i32 1, i32* %5
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %70, %0
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %72
12: ; preds = %9
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %17)
store i32 0, i32* %2
br label %19
19: ; preds = %30, %15
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %2
%24 = call i32 @letraCoeficiente(i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %27
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %28)
br label %30
30: ; preds = %22
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %19
33: ; preds = %19
br label %62
34: ; preds = %12
%35 = load i32, i32* %1
%36 = add nsw i32 %35, 1
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %36)
store i32 0, i32* %2
br label %38
38: ; preds = %58, %34
%39 = load i32, i32* %2
%40 = icmp slt i32 %39, 3
br i1 %40, label %41, label %61
41: ; preds = %38
%42 = load i32, i32* %2
%43 = call i32 @letraCoeficiente(i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %46
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %47)
%49 = load i32, i32* %2
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = sub nsw i32 %56, %52
store i32 %57, i32* %55
br label %58
58: ; preds = %41
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
store i32 %60, i32* %2
br label %38
61: ; preds = %38
br label %62
62: ; preds = %61, %33
%63 = load i32, i32* %1
%64 = add nsw i32 %63, 1
store i32 %64, i32* %1
%65 = load i32, i32* %1
%66 = icmp sgt i32 %65, 1
br i1 %66, label %67, label %70
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%69 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
br label %70
70: ; preds = %67, %62
%71 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %9
72: ; preds = %9
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%74 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%75 = call i32 @mostrarResultado(i32* %74)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [15 x i8] c"--vetor %d---\0A\00"
@.str.2 = [30 x i8] c"Informe o coeficiente de %c: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"---vetor %d---\0A\00"
@.str.5 = [51 x i8] c"Deseja informar outro vetor? (1 - Sim / 0 - Nao): \00"
@str = [35 x i8] c"---Vetor resultante (subtracao)---\00"
define void @subtracao() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = bitcast [3 x i32]* %1 to i8*
%5 = bitcast [3 x i32]* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
br label %17
17: ; preds = %0, %52
%18 = phi i32 [ %54, %52 ], [ 0, %0 ]
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 1)
%22 = call i32 @letraCoeficiente(i32 0)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %14)
%25 = call i32 @letraCoeficiente(i32 1)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %15)
%28 = call i32 @letraCoeficiente(i32 2)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %52
30: ; preds = %17
%31 = add nuw nsw i32 %18, 1
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %31)
%33 = call i32 @letraCoeficiente(i32 0)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = sub nsw i32 %37, %36
store i32 %38, i32* %9
%39 = call i32 @letraCoeficiente(i32 1)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %10)
%42 = load i32, i32* %10
%43 = load i32, i32* %11
%44 = sub nsw i32 %43, %42
store i32 %44, i32* %11
%45 = call i32 @letraCoeficiente(i32 2)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %45)
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %12)
%48 = load i32, i32* %12
%49 = load i32, i32* %13
%50 = sub nsw i32 %49, %48
store i32 %50, i32* %13
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
br label %52
52: ; preds = %20, %30
%53 = phi i32* [ %16, %20 ], [ %3, %30 ]
%54 = phi i32 [ 1, %20 ], [ %31, %30 ]
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %53)
%56 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%57 = load i32, i32* %3
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %17
59: ; preds = %52
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%61 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%62 = call i32 @mostrarResultado(i32* %61)
ret void
}