#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "Portuguese");
  int qtde, aux;
  float valorCheque, valorTotal = 0, totalLote;
  printf("Digite a quantidade de cheques: ");
  scanf("%d", &qtde);
  printf("Digite a soma do lote: ");
  scanf("%f", &totalLote);
  for (aux = 0; aux < qtde; aux++) {
    printf("Insira o valor do cheque: ");
    scanf("%f", &valorCheque);
    valorTotal += valorCheque;
  }
  printf("Soma total dos cheques: %f", totalLote);
  printf("Valor total dos cheques: %f", valorTotal);
  if (totalLote == valorTotal)
    printf("Lote ok");
  else if (totalLote > valorTotal)
    printf("Diferença negativa");
  else
    printf("Diferença positiva");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <setlocale@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ec <main+0xbc>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a3 <main+0x73>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe66(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jne    1242 <main+0x112>
jp     1242 <main+0x112>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x147>
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1264 <main+0x134>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1272 <main+0x142>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x147>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    11f4 <main+0xc4>
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
lea    0xe9f(%rip),%r14
lea    0xecb(%rip),%r15
lea    0x14(%rsp),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
add    $0x1,%ebp
cmp    0x10(%rsp),%ebp
jl     11c0 <main+0x90>
jmp    11fd <main+0xcd>
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe57(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm0
lea    0xe5e(%rip),%rax
lea    0xe6b(%rip),%rcx
cmova  %rax,%rcx
ucomiss %xmm0,%xmm1
lea    0xe41(%rip),%rdi
cmovne %rcx,%rdi
cmovp  %rcx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [11 x i8] c"Portuguese\00"
@.str.1 = [33 x i8] c"Digite a quantidade de cheques: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [24 x i8] c"Digite a soma do lote: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [27 x i8] c"Insira o valor do cheque: \00"
@.str.6 = [27 x i8] c"Soma total dos cheques: %f\00"
@.str.7 = [28 x i8] c"Valor total dos cheques: %f\00"
@.str.8 = [8 x i8] c"Lote ok\00"
@.str.9 = [20 x i8] c"Diferen\C3\A7a negativa\00"
@.str.10 = [20 x i8] c"Diferen\C3\A7a positiva\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = load i32, i32* @LC_ALL
%8 = call i32 @setlocale(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store float 0.000000e+00, float* %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %6)
store i32 0, i32* %3
br label %13
13: ; preds = %23, %0
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
%20 = load float, float* %4
%21 = load float, float* %5
%22 = fadd float %21, %20
store float %22, float* %5
br label %23
23: ; preds = %17
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %13
26: ; preds = %13
%27 = load float, float* %6
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %28)
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %31)
%33 = load float, float* %6
%34 = load float, float* %5
%35 = fcmp oeq float %33, %34
br i1 %35, label %36, label %38
36: ; preds = %26
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %47
38: ; preds = %26
%39 = load float, float* %6
%40 = load float, float* %5
%41 = fcmp ogt float %39, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %46
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %46
46: ; preds = %44, %42
br label %47
47: ; preds = %46, %36
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [11 x i8] c"Portuguese\00"
@.str.1 = [33 x i8] c"Digite a quantidade de cheques: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [24 x i8] c"Digite a soma do lote: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [27 x i8] c"Insira o valor do cheque: \00"
@.str.6 = [27 x i8] c"Soma total dos cheques: %f\00"
@.str.7 = [28 x i8] c"Valor total dos cheques: %f\00"
@.str.8 = [8 x i8] c"Lote ok\00"
@.str.9 = [20 x i8] c"Diferen\C3\A7a negativa\00"
@.str.10 = [20 x i8] c"Diferen\C3\A7a positiva\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = load i32, i32* @LC_ALL
%5 = tail call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = bitcast i32* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast float* %3 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %0, %15
%16 = phi float [ %21, %15 ], [ 0.000000e+00, %0 ]
%17 = phi i32 [ %22, %15 ], [ 0, %0 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%20 = load float, float* %2
%21 = fadd float %16, %20
%22 = add nuw nsw i32 %17, 1
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
br i1 %24, label %15, label %25
25: ; preds = %15, %0
%26 = phi float [ 0.000000e+00, %0 ], [ %21, %15 ]
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %28)
%30 = fpext float %26 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %30)
%32 = load float, float* %3
%33 = fcmp oeq float %32, %26
%34 = fcmp ogt float %32, %26
%35 = select i1 %34, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0)
%36 = select i1 %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %36)
ret i32 0
}