#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 */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcat(char *, char *);
int ui_getint(char *);
char *get_target_param(char *buf) {
  int n = ui_getint("rF072");
  if (n) {
    strcat(buf, " F072RB=1 ");
    printf("Target STM32F072RB\n");
    return buf;
  }
  n = ui_getint("rF103");
  if (n) {
    strcat(buf, " F013RB=1 ");
    printf("Target STM32F013RB\n");
    return buf;
  }
  n = ui_getint("rF401");
  if (n) {
    strcat(buf, " F401RE=1 ");
    printf("Target STM32F401RE\n");
    return buf;
  }
  n = ui_getint("rF405");
  if (n) {
    strcat(buf, " F405RG=1 ");
    printf("Target STM32F405RG\n");
    return buf;
  }
  n = ui_getint("rF051");
  if (n) {
    strcat(buf, " F051K8=1 ");
    printf("Target STM32F051K8\n");
    return buf;
  }
  printf("Unknown Target\n");
}


x86 assembly (clang, -O0):
<get_target_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <ui_getint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     117e <get_target_param+0x4e>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <strcat@plt>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1292 <get_target_param+0x162>
lea    0xea0(%rip),%rdi
call   1040 <ui_getint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c0 <get_target_param+0x90>
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1050 <strcat@plt>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1292 <get_target_param+0x162>
lea    0xe83(%rip),%rdi
call   1040 <ui_getint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1202 <get_target_param+0xd2>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1050 <strcat@plt>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1292 <get_target_param+0x162>
lea    0xe66(%rip),%rdi
call   1040 <ui_getint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1244 <get_target_param+0x114>
mov    -0x10(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1050 <strcat@plt>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1292 <get_target_param+0x162>
lea    0xe49(%rip),%rdi
call   1040 <ui_getint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1286 <get_target_param+0x156>
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcat@plt>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1292 <get_target_param+0x162>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_target_param>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xec2(%rip),%rdi
call   1040 <ui_getint@plt>
test   %eax,%eax
je     1157 <get_target_param+0x27>
lea    0xf62(%rip),%rbx
lea    0xeb1(%rip),%rsi
jmp    11d5 <get_target_param+0xa5>
lea    0xeb3(%rip),%rdi
call   1040 <ui_getint@plt>
test   %eax,%eax
je     1177 <get_target_param+0x47>
lea    0xf2f(%rip),%rbx
lea    0xea2(%rip),%rsi
jmp    11d5 <get_target_param+0xa5>
lea    0xea4(%rip),%rdi
call   1040 <ui_getint@plt>
test   %eax,%eax
je     1197 <get_target_param+0x67>
lea    0xefc(%rip),%rbx
lea    0xe93(%rip),%rsi
jmp    11d5 <get_target_param+0xa5>
lea    0xe95(%rip),%rdi
call   1040 <ui_getint@plt>
test   %eax,%eax
je     11b7 <get_target_param+0x87>
lea    0xec9(%rip),%rbx
lea    0xe84(%rip),%rsi
jmp    11d5 <get_target_param+0xa5>
lea    0xe86(%rip),%rdi
call   1040 <ui_getint@plt>
test   %eax,%eax
je     11f0 <get_target_param+0xc0>
lea    0xe96(%rip),%rbx
lea    0xe75(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe5e(%rip),%rbx
jmp    11dd <get_target_param+0xad>

LLVM IR (-O0):
@.str = [6 x i8] c"rF072\00"
@.str.1 = [11 x i8] c" F072RB=1 \00"
@.str.2 = [20 x i8] c"Target STM32F072RB\0A\00"
@.str.3 = [6 x i8] c"rF103\00"
@.str.4 = [11 x i8] c" F013RB=1 \00"
@.str.5 = [20 x i8] c"Target STM32F013RB\0A\00"
@.str.6 = [6 x i8] c"rF401\00"
@.str.7 = [11 x i8] c" F401RE=1 \00"
@.str.8 = [20 x i8] c"Target STM32F401RE\0A\00"
@.str.9 = [6 x i8] c"rF405\00"
@.str.10 = [11 x i8] c" F405RG=1 \00"
@.str.11 = [20 x i8] c"Target STM32F405RG\0A\00"
@.str.12 = [6 x i8] c"rF051\00"
@.str.13 = [11 x i8] c" F051K8=1 \00"
@.str.14 = [20 x i8] c"Target STM32F051K8\0A\00"
@.str.15 = [16 x i8] c"Unknown Target\0A\00"
define i8* @get_target_param(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%12 = load i8*, i8** %3
store i8* %12, i8** %2
br label %51
13: ; preds = %1
%14 = call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%21 = load i8*, i8** %3
store i8* %21, i8** %2
br label %51
22: ; preds = %13
%23 = call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i8*, i8** %3
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%30 = load i8*, i8** %3
store i8* %30, i8** %2
br label %51
31: ; preds = %22
%32 = call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i32 %32, i32* %4
%33 = load i32, i32* %4
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i8*, i8** %3
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%39 = load i8*, i8** %3
store i8* %39, i8** %2
br label %51
40: ; preds = %31
%41 = call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load i8*, i8** %3
%46 = call i32 @strcat(i8* %45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
%48 = load i8*, i8** %3
store i8* %48, i8** %2
br label %51
49: ; preds = %40
%50 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
br label %51
51: ; preds = %49, %44, %35, %26, %17, %8
%52 = load i8*, i8** %2
ret i8* %52
}

LLVM IR (-O2):
@.str = [6 x i8] c"rF072\00"
@.str.1 = [11 x i8] c" F072RB=1 \00"
@.str.3 = [6 x i8] c"rF103\00"
@.str.4 = [11 x i8] c" F013RB=1 \00"
@.str.6 = [6 x i8] c"rF401\00"
@.str.7 = [11 x i8] c" F401RE=1 \00"
@.str.9 = [6 x i8] c"rF405\00"
@.str.10 = [11 x i8] c" F405RG=1 \00"
@.str.12 = [6 x i8] c"rF051\00"
@.str.13 = [11 x i8] c" F051K8=1 \00"
@str = [15 x i8] c"Unknown Target\00"
@str.16 = [19 x i8] c"Target STM32F051K8\00"
@str.17 = [19 x i8] c"Target STM32F405RG\00"
@str.18 = [19 x i8] c"Target STM32F401RE\00"
@str.19 = [19 x i8] c"Target STM32F013RB\00"
@str.20 = [19 x i8] c"Target STM32F072RB\00"
define i8* @get_target_param(i8* returned %0) {
%2 = tail call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = tail call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = tail call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = tail call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32 @ui_getint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %13, %10, %7, %4, %1
%17 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %10 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), %13 ]
%18 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0), %1 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0), %4 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.18, i64 0, i64 0), %7 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.17, i64 0, i64 0), %10 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.16, i64 0, i64 0), %13 ]
%19 = tail call i32 @strcat(i8* %0, i8* %17)
br label %20
20: ; preds = %16, %13
%21 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0), %13 ], [ %18, %16 ]
%22 = tail call i32 @puts(i8* dereferenceable(1) %21)
ret i8* %0
}