#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*/ BT_err_exit(int /*<<< orphan*/);
int /*<<< orphan*/ PrintNum(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ valIth_flags(int *, int);
void WriteBpog() {
  FILE *Bpog;
  int n;
  Bpog = fopen("TMP/.Bpog", "w");
  if (Bpog == NULL) {
    printf("\n  BMotif: can't open TMP/.Bpog for writing\n");
    BT_err_exit(0);
    return;
  }
  valIth_flags(&n, 27);
  PrintNum(Bpog, n);
  fclose(Bpog);
}


x86 assembly (clang, -O0):
<WriteBpog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a2 <WriteBpog+0x42>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <BT_err_exit@plt>
jmp    11c5 <WriteBpog+0x65>
lea    -0xc(%rbp),%rdi
mov    $0x1b,%esi
call   1050 <valIth_flags@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <PrintNum@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteBpog>:
push   %rbx
sub    $0x10,%rsp
lea    0xe94(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11a9 <WriteBpog+0x49>
mov    %rax,%rbx
lea    0xc(%rsp),%rdi
mov    $0x1b,%esi
call   1050 <valIth_flags@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <PrintNum@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1070 <BT_err_exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"TMP/.Bpog\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [45 x i8] c"\0A BMotif: can't open TMP/.Bpog for writing\0A\00"
define void @WriteBpog() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @BT_err_exit(i32 0)
br label %16
9: ; preds = %0
%10 = call i32 @valIth_flags(i32* %2, i32 27)
%11 = load i32*, i32** %1
%12 = load i32, i32* %2
%13 = call i32 @PrintNum(i32* %11, i32 %12)
%14 = load i32*, i32** %1
%15 = call i32 @fclose(i32* %14)
br label %16
16: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"TMP/.Bpog\00"
@.str.1 = [2 x i8] c"w\00"
@str = [44 x i8] c"\0A BMotif: can't open TMP/.Bpog for writing\00"
define void @WriteBpog() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @BT_err_exit(i32 0)
br label %13
8: ; preds = %0
%9 = call i32 @valIth_flags(i32* %1, i32 27)
%10 = load i32, i32* %1
%11 = call i32 @PrintNum(i32* %3, i32 %10)
%12 = call i32 @fclose(i32* %3)
br label %13
13: ; preds = %8, %5
ret void
}