#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 */
scalar_t__ EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ deleteattr_numattr();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ getattr_value();
int listattr_numattr();
scalar_t__ setattr_create();
scalar_t__ setattr_name();
int /*<<< orphan*/ setup();
int /*<<< orphan*/ stdout;
int main(void) {
  setup();
  int passed = 0;
  int run = 0;
  int ret = listattr_numattr();
  run++;
  if (ret < 0) {
    fprintf(stdout, "test: an error in listAttr\n");
  } else if (ret > 0) {
    fprintf(stdout,
            "test: listAttr returning non 0 when no attrs have been created\n");
  } else {
    passed++;
  }
  run++;
  if (setattr_create() == EXIT_FAILURE) {
    fprintf(stdout, "test: setattr_create() failed\n");
  } else {
    passed++;
  }
  run++;
  if (getattr_value() == EXIT_FAILURE) {
    fprintf(stdout, "test: getattr_value failed\n");
  } else {
    passed++;
  }
  run++;
  if (deleteattr_numattr() == EXIT_FAILURE) {
    fprintf(stdout, "test: deleteattr_numattr failed\n");
  } else {
    passed++;
  }
  run++;
  if (setattr_name() == EXIT_FAILURE) {
    fprintf(stdout, "test: attr name was not set or was not read correctly\n");
  } else {
    passed++;
  }
  fprintf(stdout, "%i%% of tests passed\n", (passed / run) * 100);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1090 <setup@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1070 <listattr_numattr@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    11cd <main+0x5d>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1201 <main+0x91>
cmpl   $0x0,-0x10(%rbp)
jle    11f3 <main+0x83>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    0xe35(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11fc <main+0x8c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1201 <main+0x91>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <setattr_create@plt>
mov    0x2dc8(%rip),%rcx
cmp    (%rcx),%rax
jne    123d <main+0xcd>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1246 <main+0xd6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getattr_value@plt>
mov    0x2d83(%rip),%rcx
cmp    (%rcx),%rax
jne    1282 <main+0x112>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    128b <main+0x11b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1080 <deleteattr_numattr@plt>
mov    0x2d3e(%rip),%rcx
cmp    (%rcx),%rax
jne    12c7 <main+0x157>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
lea    0xddc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12d0 <main+0x160>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <setattr_name@plt>
mov    0x2cf9(%rip),%rcx
cmp    (%rcx),%rax
jne    130c <main+0x19c>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1315 <main+0x1a5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
imul   $0x64,%eax,%edx
lea    0xdc0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c93(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <setup@plt>
xor    %eax,%eax
call   1070 <listattr_numattr@plt>
test   %eax,%eax
js     1193 <main+0x23>
je     11ac <main+0x3c>
lea    0xe8b(%rip),%rsi
jmp    119a <main+0x2a>
lea    0xe66(%rip),%rsi
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b1 <main+0x41>
mov    $0x1,%ebx
xor    %eax,%eax
call   1030 <setattr_create@plt>
mov    0x2e21(%rip),%r14
cmp    (%r14),%rax
jne    11dd <main+0x6d>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11e0 <main+0x70>
add    $0x1,%ebx
xor    %eax,%eax
call   1050 <getattr_value@plt>
cmp    (%r14),%rax
jne    1205 <main+0x95>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1208 <main+0x98>
add    $0x1,%ebx
xor    %eax,%eax
call   1080 <deleteattr_numattr@plt>
cmp    (%r14),%rax
jne    122d <main+0xbd>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1230 <main+0xc0>
add    $0x1,%ebx
xor    %eax,%eax
call   1060 <setattr_name@plt>
cmp    (%r14),%rax
jne    1255 <main+0xe5>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1258 <main+0xe8>
add    $0x1,%ebx
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
imul   $0xcd,%ebx,%eax
shr    $0xa,%eax
imul   $0x64,%eax,%edx
lea    0xe7b(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [28 x i8] c"test: an error in listAttr\0A\00"
@.str.1 = [64 x i8] c"test: listAttr returning non 0 when no attrs have been created\0A\00"
@EXIT_FAILURE = global i64 0
@.str.2 = [31 x i8] c"test: setattr_create() failed\0A\00"
@.str.3 = [28 x i8] c"test: getattr_value failed\0A\00"
@.str.4 = [33 x i8] c"test: deleteattr_numattr failed\0A\00"
@.str.5 = [55 x i8] c"test: attr name was not set or was not read correctly\0A\00"
@.str.6 = [22 x i8] c"%i%% of tests passed\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @setup()
store i32 0, i32* %2
store i32 0, i32* %3
%6 = call i32 (...) @listattr_numattr()
store i32 %6, i32* %4
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32, i32* @stdout
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %24
14: ; preds = %0
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @stdout
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
br label %23
20: ; preds = %14
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %17
br label %24
24: ; preds = %23, %11
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
%27 = call i64 (...) @setattr_create()
%28 = load i64, i64* @EXIT_FAILURE
%29 = icmp eq i64 %27, %28
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i32, i32* @stdout
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %36
33: ; preds = %24
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
%39 = call i64 (...) @getattr_value()
%40 = load i64, i64* @EXIT_FAILURE
%41 = icmp eq i64 %39, %40
br i1 %41, label %42, label %45
42: ; preds = %36
%43 = load i32, i32* @stdout
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %48
45: ; preds = %36
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %48
48: ; preds = %45, %42
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
%51 = call i64 (...) @deleteattr_numattr()
%52 = load i64, i64* @EXIT_FAILURE
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %57
54: ; preds = %48
%55 = load i32, i32* @stdout
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
br label %60
57: ; preds = %48
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %60
60: ; preds = %57, %54
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
%63 = call i64 (...) @setattr_name()
%64 = load i64, i64* @EXIT_FAILURE
%65 = icmp eq i64 %63, %64
br i1 %65, label %66, label %69
66: ; preds = %60
%67 = load i32, i32* @stdout
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
br label %72
69: ; preds = %60
%70 = load i32, i32* %2
%71 = add nsw i32 %70, 1
store i32 %71, i32* %2
br label %72
72: ; preds = %69, %66
%73 = load i32, i32* @stdout
%74 = load i32, i32* %2
%75 = load i32, i32* %3
%76 = sdiv i32 %74, %75
%77 = mul nsw i32 %76, 100
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%79 = load i32, i32* @EXIT_SUCCESS
ret i32 %79
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [28 x i8] c"test: an error in listAttr\0A\00"
@.str.1 = [64 x i8] c"test: listAttr returning non 0 when no attrs have been created\0A\00"
@EXIT_FAILURE = global i64 0
@.str.2 = [31 x i8] c"test: setattr_create() failed\0A\00"
@.str.3 = [28 x i8] c"test: getattr_value failed\0A\00"
@.str.4 = [33 x i8] c"test: deleteattr_numattr failed\0A\00"
@.str.5 = [55 x i8] c"test: attr name was not set or was not read correctly\0A\00"
@.str.6 = [22 x i8] c"%i%% of tests passed\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @setup()
%2 = tail call i32 (...) @listattr_numattr()
%3 = icmp slt i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = icmp eq i32 %2, 0
br i1 %5, label %10, label %6
6: ; preds = %4, %0
%7 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), %4 ]
%8 = load i32, i32* @stdout
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* %7)
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 1, %4 ], [ 0, %6 ]
%12 = tail call i64 (...) @setattr_create()
%13 = load i64, i64* @EXIT_FAILURE
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* @stdout
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %20
18: ; preds = %10
%19 = add nuw nsw i32 %11, 1
br label %20
20: ; preds = %18, %15
%21 = phi i32 [ %11, %15 ], [ %19, %18 ]
%22 = tail call i64 (...) @getattr_value()
%23 = load i64, i64* @EXIT_FAILURE
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32, i32* @stdout
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %30
28: ; preds = %20
%29 = add nuw nsw i32 %21, 1
br label %30
30: ; preds = %28, %25
%31 = phi i32 [ %21, %25 ], [ %29, %28 ]
%32 = tail call i64 (...) @deleteattr_numattr()
%33 = load i64, i64* @EXIT_FAILURE
%34 = icmp eq i64 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i32, i32* @stdout
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
br label %40
38: ; preds = %30
%39 = add nuw nsw i32 %31, 1
br label %40
40: ; preds = %38, %35
%41 = phi i32 [ %31, %35 ], [ %39, %38 ]
%42 = tail call i64 (...) @setattr_name()
%43 = load i64, i64* @EXIT_FAILURE
%44 = icmp eq i64 %42, %43
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = load i32, i32* @stdout
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
br label %50
48: ; preds = %40
%49 = add nuw nsw i32 %41, 1
br label %50
50: ; preds = %48, %45
%51 = phi i32 [ %41, %45 ], [ %49, %48 ]
%52 = load i32, i32* @stdout
%53 = trunc i32 %51 to i8
%54 = udiv i8 %53, 5
%55 = zext i8 %54 to i32
%56 = mul nuw nsw i32 %55, 100
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %56)
%58 = load i32, i32* @EXIT_SUCCESS
ret i32 %58
}