#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*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fwrite(char const *, int, int /*<<< orphan*/,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ strlen(char const *);
int _save_file(const char *path, const char *txt) {
  FILE *fp = 0;
  do {
    ((void)(path && txt));
    assert(path && txt);
  } while (0);
  fp = fopen(path, "wb");
  if (fp) {
    fwrite(txt, sizeof(char), strlen(txt), fp);
    fclose(fp);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_save_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     1183 <_save_file+0x33>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x22(%rbp)
je     11a1 <_save_file+0x51>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1207 <_save_file+0xb7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1070 <fwrite@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    120e <_save_file+0xbe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_save_file>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     11b0 <_save_file+0x60>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x1,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    11b2 <_save_file+0x62>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define i32 @_save_file(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* null, i32** %6
br label %7
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ false, %7 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
%16 = load i8*, i8** %4
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i8*, i8** %5
%20 = icmp ne i8* %19, null
br label %21
21: ; preds = %18, %13
%22 = phi i1 [ false, %13 ], [ %20, %18 ]
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
br label %25
25: ; preds = %21
%26 = load i8*, i8** %4
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %6
%28 = load i32*, i32** %6
%29 = icmp ne i32* %28, null
br i1 %29, label %30, label %38
30: ; preds = %25
%31 = load i8*, i8** %5
%32 = load i8*, i8** %5
%33 = call i32 @strlen(i8* %32)
%34 = load i32*, i32** %6
%35 = call i32 @fwrite(i8* %31, i32 1, i32 %33, i32* %34)
%36 = load i32*, i32** %6
%37 = call i32 @fclose(i32* %36)
store i32 1, i32* %3
br label %39
38: ; preds = %25
store i32 0, i32* %3
br label %39
39: ; preds = %38, %30
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define i32 @_save_file(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = tail call i32 @strlen(i8* %1)
%12 = tail call i32 @fwrite(i8* %1, i32 1, i32 %11, i32* %8)
%13 = tail call i32 @fclose(i32* %8)
br label %14
14: ; preds = %2, %10
%15 = phi i32 [ 1, %10 ], [ 0, %2 ]
ret i32 %15
}