#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 */
typedef int uint32_t;

/* Variables and functions */
char *get_white_balance_single_adjust_str(int, char, char);
char *malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
char *get_white_balance_adjust_str(uint32_t adjust_mg, uint32_t adjust_ba) {
  char *ret = malloc(8);
  if (adjust_mg != 7 || adjust_ba != 7) {
    snprintf(ret, 8, "%s%s",
             get_white_balance_single_adjust_str(adjust_mg, 'M', 'G'),
             get_white_balance_single_adjust_str(adjust_ba, 'B', 'A'));
  } else {
    ret = "0";
  }
  return ret;
}


x86 assembly (clang, -O0):
<get_white_balance_adjust_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x7,-0x4(%rbp)
jne    1160 <get_white_balance_adjust_str+0x30>
cmpl   $0x7,-0x8(%rbp)
je     11b1 <get_white_balance_adjust_str+0x81>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4d,%esi
mov    $0x47,%edx
call   1050 <get_white_balance_single_adjust_str@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x42,%esi
mov    $0x41,%edx
call   1050 <get_white_balance_single_adjust_str@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    %rax,%r8
mov    $0x8,%esi
lea    0xe59(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11bc <get_white_balance_adjust_str+0x8c>
lea    0xe4d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_white_balance_adjust_str>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
cmp    $0x7,%ebp
jne    115a <get_white_balance_adjust_str+0x2a>
cmp    $0x7,%r14d
jne    115a <get_white_balance_adjust_str+0x2a>
lea    0xead(%rip),%rbx
jmp    119a <get_white_balance_adjust_str+0x6a>
mov    %ebp,%edi
mov    $0x4d,%esi
mov    $0x47,%edx
call   1050 <get_white_balance_single_adjust_str@plt>
mov    %rax,%rbp
mov    %r14d,%edi
mov    $0x42,%esi
mov    $0x41,%edx
call   1050 <get_white_balance_single_adjust_str@plt>
lea    0xe79(%rip),%rdx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %rbp,%rcx
mov    %rax,%r8
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [2 x i8] c"0\00"
define i8* @get_white_balance_adjust_str(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i8* @malloc(i32 8)
store i8* %6, i8** %5
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 7
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 7
br i1 %11, label %12, label %19
12: ; preds = %9, %2
%13 = load i8*, i8** %5
%14 = load i32, i32* %3
%15 = call i8* @get_white_balance_single_adjust_str(i32 %14, i8 signext 77, i8 signext 71)
%16 = load i32, i32* %4
%17 = call i8* @get_white_balance_single_adjust_str(i32 %16, i8 signext 66, i8 signext 65)
%18 = call i32 @snprintf(i8* %13, i32 8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %17)
br label %20
19: ; preds = %9
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %20
20: ; preds = %19, %12
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [2 x i8] c"0\00"
define i8* @get_white_balance_adjust_str(i32 %0, i32 %1) {
%3 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%4 = icmp ne i32 %0, 7
%5 = icmp ne i32 %1, 7
%6 = or i1 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = tail call i8* @get_white_balance_single_adjust_str(i32 %0, i8 signext 77, i8 signext 71)
%9 = tail call i8* @get_white_balance_single_adjust_str(i32 %1, i8 signext 66, i8 signext 65)
%10 = tail call i32 @snprintf(i8* %3, i32 8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
br label %11
11: ; preds = %2, %7
%12 = phi i8* [ %3, %7 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %2 ]
ret i8* %12
}