#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*/ XATTR_REPLACE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int setxattr(char *, char *, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
void pause_sync(void) {
  int result;
  printf("Setting pause-sync...");
  fflush(stdout);
  result = setxattr(".", "tsumufs.pause-sync", "1", strlen("1"), XATTR_REPLACE);
  if (result < 0) {
    perror("Unable to set pause-sync.");
    exit(1);
  }
  sleep(5);
  printf("Done.\n");
}


x86 assembly (clang, -O0):
<pause_sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe90(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    0x2e39(%rip),%rax
mov    (%rax),%r8d
lea    0xe63(%rip),%rdi
lea    0xe5e(%rip),%rsi
lea    0xe6a(%rip),%rdx
call   1080 <setxattr@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    11e7 <pause_sync+0x77>
lea    0xe53(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    $0x5,%edi
call   1090 <sleep@plt>
lea    0xe4d(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pause_sync>:
push   %rbx
lea    0xe78(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    0xe87(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    0x2e2f(%rip),%rcx
mov    (%rcx),%r8d
lea    0xe59(%rip),%rdi
lea    0xe54(%rip),%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1090 <setxattr@plt>
test   %eax,%eax
js     11e7 <pause_sync+0x67>
mov    $0x5,%edi
call   10a0 <sleep@plt>
lea    0xe64(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Setting pause-sync...\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c".\00"
@.str.2 = [19 x i8] c"tsumufs.pause-sync\00"
@.str.3 = [2 x i8] c"1\00"
@XATTR_REPLACE = global i32 0
@.str.4 = [26 x i8] c"Unable to set pause-sync.\00"
@.str.5 = [7 x i8] c"Done.\0A\00"
define void @pause_sync() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
%5 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = load i32, i32* @XATTR_REPLACE
%7 = call i32 @setxattr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %5, i32 %6)
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
%14 = call i32 @sleep(i32 5)
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Setting pause-sync...\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c".\00"
@.str.2 = [19 x i8] c"tsumufs.pause-sync\00"
@.str.3 = [2 x i8] c"1\00"
@XATTR_REPLACE = global i32 0
@.str.4 = [26 x i8] c"Unable to set pause-sync.\00"
@str = [6 x i8] c"Done.\00"
define void @pause_sync() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = load i32, i32* @XATTR_REPLACE
%6 = tail call i32 @setxattr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %4, i32 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = tail call i32 @sleep(i32 5)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}