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

/* Variables and functions */
int mls_conf_set(struct mls_conf *, char *, char *);
int /*<<< orphan*/ mls_conf_store(struct mls_conf *);
int /*<<< orphan*/ mls_type_data_uint_to_str(char *, unsigned int);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int mls_type_data_put_uint(struct mls_conf *storage, unsigned char epc,
                           unsigned int inb) {
  int ret = 0;
  char key[2 + 1];
  char val[4 * 2 + 1];
  sprintf(key, "%02X", epc);
  mls_type_data_uint_to_str(val, inb);
  ret = mls_conf_set(storage, key, val);
  if (ret != 0) {
    goto out;
  }
  mls_conf_store(storage);
out:
  return ret;
}


x86 assembly (clang, -O0):
<mls_type_data_put_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x17(%rbp),%rdi
lea    0xe99(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1060 <mls_type_data_uint_to_str@plt>
mov    -0x8(%rbp),%rdi
lea    -0x17(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <mls_conf_set@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119f <mls_type_data_put_uint+0x5f>
jmp    11a8 <mls_type_data_put_uint+0x68>
mov    -0x8(%rbp),%rdi
call   1030 <mls_conf_store@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mls_type_data_put_uint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %esi,%edx
mov    %rdi,%r15
lea    0xea8(%rip),%rsi
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1050 <sprintf@plt>
lea    0xf(%rsp),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <mls_type_data_uint_to_str@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <mls_conf_set@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1190 <mls_type_data_put_uint+0x50>
mov    %r15,%rdi
call   1030 <mls_conf_store@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mls_conf = type { i32 }
@.str = [5 x i8] c"%02X\00"
define i32 @mls_type_data_put_uint(%struct.mls_conf* %0, i8 zeroext %1, i32 %2) {
%4 = alloca %struct.mls_conf*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x i8]
%9 = alloca [9 x i8]
store %struct.mls_conf* %0, %struct.mls_conf** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%11 = load i8, i8* %5
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %11)
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%14 = load i32, i32* %6
%15 = call i32 @mls_type_data_uint_to_str(i8* %13, i32 %14)
%16 = load %struct.mls_conf*, %struct.mls_conf** %4
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%19 = call i32 @mls_conf_set(%struct.mls_conf* %16, i8* %17, i8* %18)
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %3
br label %26
23: ; preds = %3
%24 = load %struct.mls_conf*, %struct.mls_conf** %4
%25 = call i32 @mls_conf_store(%struct.mls_conf* %24)
br label %26
26: ; preds = %23, %22
%27 = load i32, i32* %7
ret i32 %27
}

LLVM IR (-O2):
%struct.mls_conf = type { i32 }
@.str = [5 x i8] c"%02X\00"
define i32 @mls_type_data_put_uint(%struct.mls_conf* %0, i8 zeroext %1, i32 %2) {
%4 = alloca [3 x i8]
%5 = alloca [9 x i8]
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%8 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
%9 = call i32 @mls_type_data_uint_to_str(i8* %7, i32 %2)
%10 = call i32 @mls_conf_set(%struct.mls_conf* %0, i8* %6, i8* %7)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @mls_conf_store(%struct.mls_conf* %0)
br label %14
14: ; preds = %3, %12
ret i32 %10
}