#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 */
scalar_t__ config_read(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int configurate(char *add) {
  FILE *fp;
  if ((fp = fopen(add, "r")) == NULL) {
    perror(add);
    return 0;
  }
  if (config_read(fp) == 0) {
    fclose(fp);
    exit(2);
  }
  fclose(fp);
  return 1;
}


x86 assembly (clang, -O0):
<configurate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    118f <configurate+0x3f>
mov    -0x10(%rbp),%rdi
call   1060 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <configurate+0x75>
mov    -0x18(%rbp),%rdi
call   1040 <config_read@plt>
cmp    $0x0,%rax
jne    11b5 <configurate+0x65>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x2,%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configurate>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xea2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1190 <configurate+0x40>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <config_read@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
test   %r14,%r14
je     119c <configurate+0x4c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
call   1060 <perror@plt>
xor    %eax,%eax
jmp    1188 <configurate+0x38>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @configurate(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @perror(i8* %9)
store i32 0, i32* %2
br label %22
11: ; preds = %1
%12 = load i32*, i32** %4
%13 = call i64 @config_read(i32* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = call i32 @fclose(i32* %16)
%18 = call i32 @exit(i32 2)
unreachable
19: ; preds = %11
%20 = load i32*, i32** %4
%21 = call i32 @fclose(i32* %20)
store i32 1, i32* %2
br label %22
22: ; preds = %19, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @configurate(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror(i8* %0)
br label %12
6: ; preds = %1
%7 = tail call i64 @config_read(i32* %2)
%8 = icmp eq i64 %7, 0
%9 = tail call i32 @fclose(i32* %2)
br i1 %8, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @exit(i32 2)
unreachable
12: ; preds = %6, %4
%13 = phi i32 [ 0, %4 ], [ 1, %6 ]
ret i32 %13
}