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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ deleteAttr(char *, char *);
int /*<<< orphan*/ getAttr(char *, char *, char *, scalar_t__);
int /*<<< orphan*/ setattr_testattr();
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
ssize_t getattr_value() {
  setattr_testattr();
  char testAttrVal[] = "testing";
  getAttr("testFile", "ctest_testing", testAttrVal, strlen("testing") + 1);
  deleteAttr("testFile", "ctest_testing");
  if (strcmp(testAttrVal, "testing") != 0) {
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<getattr_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1060 <setattr_testattr@plt>
mov    0xea9(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe96(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
add    $0x1,%rcx
lea    0xe70(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1070 <getAttr@plt>
lea    0xe5d(%rip),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <deleteAttr@plt>
lea    -0xc(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11da <getattr_value+0x8a>
mov    0x2e10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <getattr_value+0x96>
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getattr_value>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <setattr_testattr@plt>
movabs $0x676e6974736574,%rax
mov    %rax,0x8(%rsp)
lea    0xe9a(%rip),%rbx
lea    0xe9c(%rip),%r14
lea    0x8(%rsp),%r15
mov    $0x8,%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <getAttr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <deleteAttr@plt>
lea    0xe78(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11ad <getattr_value+0x6d>
mov    0x2e2d(%rip),%rax
jmp    11b4 <getattr_value+0x74>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.getattr_value.testAttrVal = [8 x i8] c"testing\00"
@.str = [9 x i8] c"testFile\00"
@.str.1 = [14 x i8] c"ctest_testing\00"
@.str.2 = [8 x i8] c"testing\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @getattr_value() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = call i32 (...) @setattr_testattr()
%4 = bitcast [8 x i8]* %2 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%6 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = add nsw i64 %6, 1
%8 = call i32 @getAttr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %5, i64 %7)
%9 = call i32 @deleteAttr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = load i32, i32* @EXIT_FAILURE
store i32 %14, i32* %1
br label %17
15: ; preds = %0
%16 = load i32, i32* @EXIT_SUCCESS
store i32 %16, i32* %1
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [9 x i8] c"testFile\00"
@.str.1 = [14 x i8] c"ctest_testing\00"
@.str.2 = [8 x i8] c"testing\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @getattr_value() {
%1 = alloca i64
%2 = tail call i32 (...) @setattr_testattr()
%3 = bitcast i64* %1 to i8*
store i64 29113321805538676, i64* %1
%4 = call i32 @getAttr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3, i64 8)
%5 = call i32 @deleteAttr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = load i32, i32* @EXIT_SUCCESS
%9 = load i32, i32* @EXIT_FAILURE
%10 = select i1 %7, i32 %8, i32 %9
ret i32 %10
}