#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 mg_context {
  int dummy;
};

/* Variables and functions */
int mg_modify_passwords_file(struct mg_context *, char const *, char const *,
                             char const *);
int /*<<< orphan*/ mg_set_option(struct mg_context *, char *, char const *);
struct mg_context *mg_start();
int /*<<< orphan*/ mg_stop(struct mg_context *);
int mg_edit_passwords(const char *fname, const char *domain, const char *user,
                      const char *pass) {
  struct mg_context *ctx;
  int retval;
  ctx = mg_start();
  (void)mg_set_option(ctx, "auth_realm", domain);
  retval = mg_modify_passwords_file(ctx, fname, user, pass);
  mg_stop(ctx);
  return (retval);
}


x86 assembly (clang, -O0):
<mg_edit_passwords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1040 <mg_start@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe8e(%rip),%rsi
call   1050 <mg_set_option@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <mg_modify_passwords_file@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <mg_stop@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_edit_passwords>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r12
xor    %eax,%eax
call   1040 <mg_start@plt>
mov    %rax,%rbx
lea    0xe98(%rip),%rsi
mov    %rax,%rdi
mov    %r13,%rdx
call   1050 <mg_set_option@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <mg_modify_passwords_file@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <mg_stop@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mg_context = type { i32 }
@.str = [11 x i8] c"auth_realm\00"
define i32 @mg_edit_passwords(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.mg_context*
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = call %struct.mg_context* (...) @mg_start()
store %struct.mg_context* %11, %struct.mg_context** %9
%12 = load %struct.mg_context*, %struct.mg_context** %9
%13 = load i8*, i8** %6
%14 = call i32 @mg_set_option(%struct.mg_context* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load %struct.mg_context*, %struct.mg_context** %9
%16 = load i8*, i8** %5
%17 = load i8*, i8** %7
%18 = load i8*, i8** %8
%19 = call i32 @mg_modify_passwords_file(%struct.mg_context* %15, i8* %16, i8* %17, i8* %18)
store i32 %19, i32* %10
%20 = load %struct.mg_context*, %struct.mg_context** %9
%21 = call i32 @mg_stop(%struct.mg_context* %20)
%22 = load i32, i32* %10
ret i32 %22
}

LLVM IR (-O2):
%struct.mg_context = type { i32 }
@.str = [11 x i8] c"auth_realm\00"
define i32 @mg_edit_passwords(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call %struct.mg_context* (...) @mg_start()
%6 = tail call i32 @mg_set_option(%struct.mg_context* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = tail call i32 @mg_modify_passwords_file(%struct.mg_context* %5, i8* %0, i8* %2, i8* %3)
%8 = tail call i32 @mg_stop(%struct.mg_context* %5)
ret i32 %7
}