#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 */
struct arg_parser {
  int dummy;
};
struct ap_Mutex_state {
  int dummy;
};

/* Variables and functions */
int ap_check_mutex(struct arg_parser const *const, struct ap_Mutex_state *const,
                   int const, int *);
int /*<<< orphan*/ ap_set_mutex(struct arg_parser const *const,
                                struct ap_Mutex_state *const, int const);
bool ap_set_check_mutex(const struct arg_parser *const ap,
                        struct ap_Mutex_state *const ms, const int i,
                        int *conflict) {
  bool ret = ap_check_mutex(ap, ms, i, conflict);
  ap_set_mutex(ap, ms, i);
  return ret;
}


x86 assembly (clang, -O0):
<ap_set_check_mutex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <ap_check_mutex@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ap_set_mutex@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_set_check_mutex>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1040 <ap_check_mutex@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <ap_set_mutex@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.arg_parser = type { i32 }
%struct.ap_Mutex_state = type { i32 }
define i32 @ap_set_check_mutex(%struct.arg_parser* %0, %struct.ap_Mutex_state* %1, i32 %2, i32* %3) {
%5 = alloca %struct.arg_parser*
%6 = alloca %struct.ap_Mutex_state*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store %struct.arg_parser* %0, %struct.arg_parser** %5
store %struct.ap_Mutex_state* %1, %struct.ap_Mutex_state** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = load %struct.arg_parser*, %struct.arg_parser** %5
%11 = load %struct.ap_Mutex_state*, %struct.ap_Mutex_state** %6
%12 = load i32, i32* %7
%13 = load i32*, i32** %8
%14 = call i32 @ap_check_mutex(%struct.arg_parser* %10, %struct.ap_Mutex_state* %11, i32 %12, i32* %13)
store i32 %14, i32* %9
%15 = load %struct.arg_parser*, %struct.arg_parser** %5
%16 = load %struct.ap_Mutex_state*, %struct.ap_Mutex_state** %6
%17 = load i32, i32* %7
%18 = call i32 @ap_set_mutex(%struct.arg_parser* %15, %struct.ap_Mutex_state* %16, i32 %17)
%19 = load i32, i32* %9
ret i32 %19
}

LLVM IR (-O2):
%struct.arg_parser = type { i32 }
%struct.ap_Mutex_state = type { i32 }
define i32 @ap_set_check_mutex(%struct.arg_parser* %0, %struct.ap_Mutex_state* %1, i32 %2, i32* %3) {
%5 = tail call i32 @ap_check_mutex(%struct.arg_parser* %0, %struct.ap_Mutex_state* %1, i32 %2, i32* %3)
%6 = tail call i32 @ap_set_mutex(%struct.arg_parser* %0, %struct.ap_Mutex_state* %1, i32 %2)
ret i32 %5
}