#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__ matches(char const *, char *);
char *path_getextension(char const *);
scalar_t__ prj_is_buildaction(int /*<<< orphan*/ *);
int /*<<< orphan*/ prj_select_file(char const *);
int /*<<< orphan*/ prj_set_buildaction(char *);
const char *assignEmbeddedFiles(const char *name) {
  const char *ext = path_getextension(name);
  prj_select_file(name);
  if (prj_is_buildaction(NULL) && matches(ext, ".resx"))
    prj_set_buildaction("EmbeddedResource");
  return NULL;
}


x86 assembly (clang, -O0):
<assignEmbeddedFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <path_getextension@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <prj_select_file@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <prj_is_buildaction@plt>
cmp    $0x0,%rax
je     11ab <assignEmbeddedFiles+0x5b>
mov    -0x10(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <matches@plt>
cmp    $0x0,%rax
je     11ab <assignEmbeddedFiles+0x5b>
lea    0xe60(%rip),%rdi
call   1070 <prj_set_buildaction@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assignEmbeddedFiles>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <path_getextension@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <prj_select_file@plt>
xor    %edi,%edi
call   1060 <prj_is_buildaction@plt>
test   %rax,%rax
je     1193 <assignEmbeddedFiles+0x43>
lea    0xe86(%rip),%rsi
mov    %r14,%rdi
call   1040 <matches@plt>
test   %rax,%rax
je     1193 <assignEmbeddedFiles+0x43>
lea    0xe78(%rip),%rdi
call   1070 <prj_set_buildaction@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c".resx\00"
@.str.1 = [17 x i8] c"EmbeddedResource\00"
define i8* @assignEmbeddedFiles(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @path_getextension(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @prj_select_file(i8* %6)
%8 = call i64 @prj_is_buildaction(i32* null)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @matches(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @prj_set_buildaction(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %10, %1
ret i8* null
}

LLVM IR (-O2):
@.str = [6 x i8] c".resx\00"
@.str.1 = [17 x i8] c"EmbeddedResource\00"
define noalias i8* @assignEmbeddedFiles(i8* %0) {
%2 = tail call i8* @path_getextension(i8* %0)
%3 = tail call i32 @prj_select_file(i8* %0)
%4 = tail call i64 @prj_is_buildaction(i32* null)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = tail call i64 @matches(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @prj_set_buildaction(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6, %1
ret i8* null
}