#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*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int carregar_fitxers(FILE *expedients, FILE *asignatures) {
  expedients = fopen("dades\expedient_12345.txt", "r");
  asignatures = fopen("dades\asgs-get.txt", "r");
  if (expedients && asignatures == NULL) {
    printf("ERROR \n");
    printf("Revisa el fitxer estudiants.txt");
    return (0);
  }
}


x86 assembly (clang, -O0):
<carregar_fitxers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xec9(%rip),%rdi
lea    0xedb(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xecd(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1193 <carregar_fitxers+0x73>
cmpq   $0x0,-0x18(%rbp)
jne    1193 <carregar_fitxers+0x73>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carregar_fitxers>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
lea    0xed7(%rip),%r14
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
test   %rbx,%rbx
je     117e <carregar_fitxers+0x4e>
test   %rax,%rax
jne    117e <carregar_fitxers+0x4e>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"dades\1Bxpedient_12345.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"dades\07sgs-get.txt\00"
@.str.3 = [8 x i8] c"ERROR \0A\00"
@.str.4 = [32 x i8] c"Revisa el fitxer estudiants.txt\00"
define i32 @carregar_fitxers(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %4
%7 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %4
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32*, i32** %5
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %16
16: ; preds = %13, %10, %2
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [25 x i8] c"dades\1Bxpedient_12345.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"dades\07sgs-get.txt\00"
@.str.4 = [32 x i8] c"Revisa el fitxer estudiants.txt\00"
@str = [7 x i8] c"ERROR \00"
define i32 @carregar_fitxers(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp ne i32* %3, null
%6 = icmp eq i32* %4, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %11
11: ; preds = %8, %2
ret i32 0
}