#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*/ snprintf(char *, int, char *, char const *, ...);
void geoip_set_country(const char *country, const char *code, char *loc) {
  if (country && code)
    snprintf(loc, 48 + 3, "%s %s", code, country);
  else
    snprintf(loc, 48 + 3, "%s", "Unknown");
}


x86 assembly (clang, -O0):
<geoip_set_country>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115e <geoip_set_country+0x4e>
cmpq   $0x0,-0x10(%rbp)
je     115e <geoip_set_country+0x4e>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    $0x33,%esi
lea    0xeae(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    117c <geoip_set_country+0x6c>
mov    -0x18(%rbp),%rdi
mov    $0x33,%esi
lea    0xe95(%rip),%rdx
lea    0xe91(%rip),%rcx
mov    $0x0,%al
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geoip_set_country>:
test   %rdi,%rdi
je     1139 <geoip_set_country+0x29>
mov    %rsi,%rcx
test   %rsi,%rsi
je     1139 <geoip_set_country+0x29>
mov    %rdi,%r8
lea    0xed9(%rip),%rax
mov    %rdx,%rdi
mov    $0x33,%esi
mov    %rax,%rdx
xor    %eax,%eax
jmp    1030 <snprintf@plt>
lea    0xec3(%rip),%rax
lea    0xebf(%rip),%rcx
mov    %rdx,%rdi
mov    $0x33,%esi
mov    %rax,%rdx
xor    %eax,%eax
jmp    1030 <snprintf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c"Unknown\00"
define void @geoip_set_country(i8* %0, i8* %1, i8* %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %2, i32 51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
br label %11
9: ; preds = %3
%10 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %2, i32 51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret void
}