#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 extract_resources(char *, float *);
int /*<<< orphan*/ print_xresources(float *);
char *test_extract_resources() {
  float colors[54];
  int res = extract_resources("tests/0001.resources", colors);
  print_xresources(colors);
  do {
    if (!(res == 0))
      return "extract_resources failed";
  } while (0);
  do {
    if (!(((float)0xF7) / 255.0f == colors[0]))
      return "background wrong";
  } while (0);
  do {
    if (!(((float)0x35) / 255.0f == colors[3]))
      return "foreground wrong";
  } while (0);
  do {
    if (!(((float)0x45) / 255.0f == colors[53]))
      return "color15 wrong";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_extract_resources>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
lea    -0xe0(%rbp),%rsi
lea    0xed3(%rip),%rdi
call   1030 <extract_resources@plt>
mov    %eax,-0xe4(%rbp)
lea    -0xe0(%rbp),%rdi
call   1040 <print_xresources@plt>
cmpl   $0x0,-0xe4(%rbp)
je     116d <test_extract_resources+0x4d>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <test_extract_resources+0x105>
jmp    1172 <test_extract_resources+0x52>
jmp    1177 <test_extract_resources+0x57>
movss  0xe81(%rip),%xmm0
ucomiss -0xe0(%rbp),%xmm0
jne    1197 <test_extract_resources+0x77>
jp     1197 <test_extract_resources+0x77>
jmp    11a7 <test_extract_resources+0x87>
lea    0xe9c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <test_extract_resources+0x105>
jmp    11ac <test_extract_resources+0x8c>
jmp    11b1 <test_extract_resources+0x91>
movss  0xe4b(%rip),%xmm0
ucomiss -0xd4(%rbp),%xmm0
jne    11d1 <test_extract_resources+0xb1>
jp     11d1 <test_extract_resources+0xb1>
jmp    11e1 <test_extract_resources+0xc1>
lea    0xe73(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <test_extract_resources+0x105>
jmp    11e6 <test_extract_resources+0xc6>
jmp    11eb <test_extract_resources+0xcb>
movss  0xe15(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jne    1208 <test_extract_resources+0xe8>
jp     1208 <test_extract_resources+0xe8>
jmp    1218 <test_extract_resources+0xf8>
lea    0xe4d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1225 <test_extract_resources+0x105>
jmp    121d <test_extract_resources+0xfd>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_extract_resources>:
push   %rbp
push   %rbx
sub    $0xd8,%rsp
lea    0xedc(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <extract_resources@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <print_xresources@plt>
test   %ebp,%ebp
je     115a <test_extract_resources+0x3a>
lea    0xed1(%rip),%rax
add    $0xd8,%rsp
pop    %rbx
pop    %rbp
ret
movss  (%rsp),%xmm0
ucomiss 0xe9a(%rip),%xmm0
jne    119e <test_extract_resources+0x7e>
jp     119e <test_extract_resources+0x7e>
movss  0xc(%rsp),%xmm0
ucomiss 0xe8d(%rip),%xmm0
jne    11a7 <test_extract_resources+0x87>
jp     11a7 <test_extract_resources+0x87>
movss  0xd4(%rsp),%xmm0
xor    %eax,%eax
ucomiss 0xe7b(%rip),%xmm0
lea    0xec8(%rip),%rcx
cmovne %rcx,%rax
cmovp  %rcx,%rax
jmp    1150 <test_extract_resources+0x30>
lea    0xe95(%rip),%rax
jmp    1150 <test_extract_resources+0x30>
lea    0xe9d(%rip),%rax
jmp    1150 <test_extract_resources+0x30>

LLVM IR (-O0):
@.str = [21 x i8] c"tests/0001.resources\00"
@.str.1 = [25 x i8] c"extract_resources failed\00"
@.str.2 = [17 x i8] c"background wrong\00"
@.str.3 = [17 x i8] c"foreground wrong\00"
@.str.4 = [14 x i8] c"color15 wrong\00"
define i8* @test_extract_resources() {
%1 = alloca i8*
%2 = alloca [54 x float]
%3 = alloca i32
%4 = getelementptr inbounds [54 x float], [54 x float]* %2, i64 0, i64 0
%5 = call i32 @extract_resources(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), float* %4)
store i32 %5, i32* %3
%6 = getelementptr inbounds [54 x float], [54 x float]* %2, i64 0, i64 0
%7 = call i32 @print_xresources(float* %6)
br label %8
8: ; preds = %0
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %35
12: ; preds = %8
br label %13
13: ; preds = %12
br label %14
14: ; preds = %13
%15 = getelementptr inbounds [54 x float], [54 x float]* %2, i64 0, i64 0
%16 = load float, float* %15
%17 = fcmp oeq float 0x3FEEFEFF00000000, %16
br i1 %17, label %19, label %18
18: ; preds = %14
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %35
19: ; preds = %14
br label %20
20: ; preds = %19
br label %21
21: ; preds = %20
%22 = getelementptr inbounds [54 x float], [54 x float]* %2, i64 0, i64 3
%23 = load float, float* %22
%24 = fcmp oeq float 0x3FCA9A9AA0000000, %23
br i1 %24, label %26, label %25
25: ; preds = %21
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %35
26: ; preds = %21
br label %27
27: ; preds = %26
br label %28
28: ; preds = %27
%29 = getelementptr inbounds [54 x float], [54 x float]* %2, i64 0, i64 53
%30 = load float, float* %29
%31 = fcmp oeq float 0x3FD1515160000000, %30
br i1 %31, label %33, label %32
32: ; preds = %28
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %35
33: ; preds = %28
br label %34
34: ; preds = %33
store i8* null, i8** %1
br label %35
35: ; preds = %34, %32, %25, %18, %11
%36 = load i8*, i8** %1
ret i8* %36
}

LLVM IR (-O2):
@.str = [21 x i8] c"tests/0001.resources\00"
@.str.1 = [25 x i8] c"extract_resources failed\00"
@.str.2 = [17 x i8] c"background wrong\00"
@.str.3 = [17 x i8] c"foreground wrong\00"
@.str.4 = [14 x i8] c"color15 wrong\00"
define i8* @test_extract_resources() {
%1 = alloca [54 x float]
%2 = bitcast [54 x float]* %1 to i8*
%3 = getelementptr inbounds [54 x float], [54 x float]* %1, i64 0, i64 0
%4 = call i32 @extract_resources(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), float* %3)
%5 = call i32 @print_xresources(float* %3)
%6 = icmp eq i32 %4, 0
br i1 %6, label %7, label %19
7: ; preds = %0
%8 = load float, float* %3
%9 = fcmp oeq float %8, 0x3FEEFEFF00000000
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = getelementptr inbounds [54 x float], [54 x float]* %1, i64 0, i64 3
%12 = load float, float* %11
%13 = fcmp oeq float %12, 0x3FCA9A9AA0000000
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = getelementptr inbounds [54 x float], [54 x float]* %1, i64 0, i64 53
%16 = load float, float* %15
%17 = fcmp oeq float %16, 0x3FD1515160000000
%18 = select i1 %17, i8* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0)
br label %19
19: ; preds = %14, %10, %7, %0
%20 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %10 ], [ %18, %14 ]
ret i8* %20
}