#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, char *);
scalar_t__ strcmp(char *, char *);
void procesar_albaran(float precios[10], float gano[12][2]) {
  FILE *fich;
  int codigo, unidades, mes, columna;
  char tipo[20];
  fich = fopen("albaran.txt", "r");
  while (fscanf(fich, "%d%d%d%s", &codigo, &unidades, &mes, tipo) == 4) {
    if (strcmp(tipo, "enA") == 0) {
      columna = 0;
    } else {
      columna = 1;
    }
    gano[mes - 1][columna] =
        gano[mes - 1][columna] + precios[codigo] * unidades;
  }
  fclose(fich);
}


x86 assembly (clang, -O0):
<procesar_albaran>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%r9
lea    0xe98(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
call   1040 <fscanf@plt>
cmp    $0x4,%eax
jne    1216 <procesar_albaran+0xd6>
lea    -0x40(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <procesar_albaran+0x76>
movl   $0x0,-0x28(%rbp)
jmp    11bd <procesar_albaran+0x7d>
movl   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1167 <procesar_albaran+0x27>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procesar_albaran>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xea5(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r13
lea    0xe9d(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
lea    0x10(%rsp),%r9
mov    %rax,%rdi
call   1040 <fscanf@plt>
cmp    $0x4,%eax
jne    1212 <procesar_albaran+0xd2>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%rbp
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xe5d(%rip),%rsi
call   1050 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
xorps  %xmm0,%xmm0
cvtsi2ssl 0x8(%rsp),%xmm0
movslq 0x4(%rsp),%rax
movslq 0xc(%rsp),%rdx
mulss  (%r15,%rdx,4),%xmm0
lea    (%r14,%rax,8),%rax
addss  -0x8(%rax,%rcx,4),%xmm0
movss  %xmm0,-0x8(%rax,%rcx,4)
mov    %r13,%rdi
lea    0xe14(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbp,%rcx
mov    %r12,%r8
mov    %rbx,%r9
call   1040 <fscanf@plt>
cmp    $0x4,%eax
je     11b0 <procesar_albaran+0x70>
mov    %r13,%rdi
call   1030 <fclose@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"albaran.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d%d%d%s\00"
@.str.3 = [4 x i8] c"enA\00"
define void @procesar_albaran(float* %0, [2 x float]* %1) {
%3 = alloca float*
%4 = alloca [2 x float]*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [20 x i8]
store float* %0, float** %3
store [2 x float]* %1, [2 x float]** %4
%11 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %5
br label %12
12: ; preds = %23, %2
%13 = load i32*, i32** %5
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%15 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %6, i32* %7, i32* %8, i8* %14)
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %49
17: ; preds = %12
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %9
br label %23
22: ; preds = %17
store i32 1, i32* %9
br label %23
23: ; preds = %22, %21
%24 = load [2 x float]*, [2 x float]** %4
%25 = load i32, i32* %8
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2 x float], [2 x float]* %24, i64 %27
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [2 x float], [2 x float]* %28, i64 0, i64 %30
%32 = load float, float* %31
%33 = load float*, float** %3
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
%37 = load float, float* %36
%38 = load i32, i32* %7
%39 = sitofp i32 %38 to float
%40 = call float @llvm.fmuladd.f32(float %37, float %39, float %32)
%41 = load [2 x float]*, [2 x float]** %4
%42 = load i32, i32* %8
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2 x float], [2 x float]* %41, i64 %44
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [2 x float], [2 x float]* %45, i64 0, i64 %47
store float %40, float* %48
br label %12
49: ; preds = %12
%50 = load i32*, i32** %5
%51 = call i32 @fclose(i32* %50)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"albaran.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d%d%d%s\00"
@.str.3 = [4 x i8] c"enA\00"
define void @procesar_albaran(float* nocapture %0, [2 x float]* nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i8* %10)
%13 = icmp eq i32 %12, 4
br i1 %13, label %14, label %32
14: ; preds = %2, %14
%15 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i64
%18 = load i32, i32* %5
%19 = add nsw i32 %18, -1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 %20, i64 %17
%22 = load float, float* %21
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %0, i64 %24
%26 = load float, float* %25
%27 = load i32, i32* %4
%28 = sitofp i32 %27 to float
%29 = call float @llvm.fmuladd.f32(float %26, float %28, float %22)
store float %29, float* %21
%30 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i8* %10)
%31 = icmp eq i32 %30, 4
br i1 %31, label %14, label %32
32: ; preds = %14, %2
%33 = call i32 @fclose(i32* %11)
ret void
}