#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *, ...);
int /*<<< orphan*/ strcmp(char const *, char const *);
void generate_arg(FILE *f, const char *gct, const char *type, const char *arg) {
  if (!strcmp(gct, type)) {
    fprintf(f, "%s.get_%s()", arg, type);
  } else {
    fprintf(f, "%s2%s(%s)", type, gct, arg);
  }
}


x86 assembly (clang, -O0):
<generate_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    116d <generate_arg+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    118b <generate_arg+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_arg>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1168 <generate_arg+0x48>
lea    0xec2(%rip),%rsi
mov    %r15,%rdi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>
lea    0xe91(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
mov    %r12,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%s.get_%s()\00"
@.str.1 = [10 x i8] c"%s2%s(%s)\00"
define void @generate_arg(i32* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %7
%11 = call i32 @strcmp(i8* %9, i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %4
%14 = load i32*, i32** %5
%15 = load i8*, i8** %8
%16 = load i8*, i8** %7
%17 = call i32 (i32*, i8*, i8*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
br label %24
18: ; preds = %4
%19 = load i32*, i32** %5
%20 = load i8*, i8** %7
%21 = load i8*, i8** %6
%22 = load i8*, i8** %8
%23 = call i32 (i32*, i8*, i8*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21, i8* %22)
br label %24
24: ; preds = %18, %13
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s.get_%s()\00"
@.str.1 = [10 x i8] c"%s2%s(%s)\00"
define void @generate_arg(i32* nocapture %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(1) %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 (i32*, i8*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %2)
br label %11
9: ; preds = %4
%10 = tail call i32 (i32*, i8*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %1, i8* %3)
br label %11
11: ; preds = %9, %7
ret void
}