#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 */
char *pipe_buffer_lock();
int /*<<< orphan*/ pipe_buffer_unlock(char *, int);
int /*<<< orphan*/ write_dword(char *, int);
int /*<<< orphan*/ write_string(char *, char const *);
int write_output_settings(const char *output_dir, const char *postproc) {
  char *_buffer = pipe_buffer_lock(), *_ptr = _buffer, *_packet_start;
  _ptr += write_dword(_ptr, ('O' | ('C' << 8) | ('F' << 16) | ('G' << 24)));
  _packet_start = (_ptr += 4, _ptr - 4);
  ;
  ;
  ;
  _ptr += write_string(_ptr, output_dir);
  ;
  _ptr += write_string(_ptr, postproc);
  ;
  write_dword(_packet_start, _ptr - _packet_start - 4);
  ;
  ;
  pipe_buffer_unlock(_buffer, _ptr - _buffer);
  return _ptr - _buffer;
  ;
}


x86 assembly (clang, -O0):
<write_output_settings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <pipe_buffer_lock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x4746434f,%esi
call   1050 <write_dword@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <write_string@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <write_string@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
sub    $0x4,%rax
mov    %eax,%esi
call   1050 <write_dword@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1030 <pipe_buffer_unlock@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_output_settings>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1060 <pipe_buffer_lock@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x4746434f,%esi
call   1050 <write_dword@plt>
cltq
lea    (%rbx,%rax,1),%r12
lea    (%rbx,%rax,1),%rdi
add    $0x4,%rdi
mov    %r15,%rsi
call   1040 <write_string@plt>
cltq
lea    (%rax,%r12,1),%r15
add    $0x4,%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <write_string@plt>
mov    %eax,%ebp
add    %r15d,%ebp
mov    %ebp,%esi
sub    %r12d,%esi
add    $0xfffffffc,%esi
mov    %r12,%rdi
call   1050 <write_dword@plt>
sub    %ebx,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <pipe_buffer_unlock@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @write_output_settings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = call i8* (...) @pipe_buffer_lock()
store i8* %8, i8** %5
%9 = load i8*, i8** %5
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @write_dword(i8* %10, i32 1195787087)
%12 = load i8*, i8** %6
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds i8, i8* %12, i64 %13
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 4
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 -4
store i8* %18, i8** %7
%19 = load i8*, i8** %6
%20 = load i8*, i8** %3
%21 = call i32 @write_string(i8* %19, i8* %20)
%22 = load i8*, i8** %6
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds i8, i8* %22, i64 %23
store i8* %24, i8** %6
%25 = load i8*, i8** %6
%26 = load i8*, i8** %4
%27 = call i32 @write_string(i8* %25, i8* %26)
%28 = load i8*, i8** %6
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds i8, i8* %28, i64 %29
store i8* %30, i8** %6
%31 = load i8*, i8** %7
%32 = load i8*, i8** %6
%33 = load i8*, i8** %7
%34 = ptrtoint i8* %32 to i64
%35 = ptrtoint i8* %33 to i64
%36 = sub i64 %34, %35
%37 = sub nsw i64 %36, 4
%38 = trunc i64 %37 to i32
%39 = call i32 @write_dword(i8* %31, i32 %38)
%40 = load i8*, i8** %5
%41 = load i8*, i8** %6
%42 = load i8*, i8** %5
%43 = ptrtoint i8* %41 to i64
%44 = ptrtoint i8* %42 to i64
%45 = sub i64 %43, %44
%46 = trunc i64 %45 to i32
%47 = call i32 @pipe_buffer_unlock(i8* %40, i32 %46)
%48 = load i8*, i8** %6
%49 = load i8*, i8** %5
%50 = ptrtoint i8* %48 to i64
%51 = ptrtoint i8* %49 to i64
%52 = sub i64 %50, %51
%53 = trunc i64 %52 to i32
ret i32 %53
}

LLVM IR (-O2):
define i32 @write_output_settings(i8* %0, i8* %1) {
%3 = tail call i8* (...) @pipe_buffer_lock()
%4 = tail call i32 @write_dword(i8* %3, i32 1195787087)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = getelementptr inbounds i8, i8* %6, i64 4
%8 = getelementptr inbounds i8, i8* %7, i64 -4
%9 = tail call i32 @write_string(i8* %7, i8* %0)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = tail call i32 @write_string(i8* %11, i8* %1)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = ptrtoint i8* %14 to i64
%16 = ptrtoint i8* %8 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
%19 = add i32 %18, -4
%20 = tail call i32 @write_dword(i8* %8, i32 %19)
%21 = ptrtoint i8* %3 to i64
%22 = sub i64 %15, %21
%23 = trunc i64 %22 to i32
%24 = tail call i32 @pipe_buffer_unlock(i8* %3, i32 %23)
ret i32 %23
}