#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 */

/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
scalar_t__ write(int, char *, int /*<<< orphan*/);
int writeM(char *mess) {
  int fd;
  char *myfifo = "/mtd_ram/mountD_";
  fd = open(myfifo, O_WRONLY);
  if (write(fd, mess, strlen(mess)) < 0) {
    close(fd);
    return -1;
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<writeM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jge    11af <writeM+0x6f>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11be <writeM+0x7e>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeM>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1050 <close@plt>
sar    $0x3f,%rbx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/mtd_ram/mountD_\00"
@O_WRONLY = global i32 0
define i32 @writeM(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %5
%7 = load i32, i32* @O_WRONLY
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = load i8*, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = call i64 @write(i32 %9, i8* %10, i32 %12)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load i32, i32* %4
%17 = call i32 @close(i32 %16)
store i32 -1, i32* %2
br label %21
18: ; preds = %1
%19 = load i32, i32* %4
%20 = call i32 @close(i32 %19)
store i32 0, i32* %2
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [17 x i8] c"/mtd_ram/mountD_\00"
@O_WRONLY = global i32 0
define i32 @writeM(i8* %0) {
%2 = load i32, i32* @O_WRONLY
%3 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i64 @write(i32 %3, i8* %0, i32 %4)
%6 = tail call i32 @close(i32 %3)
%7 = ashr i64 %5, 63
%8 = trunc i64 %7 to i32
ret i32 %8
}