#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 */
scalar_t__ google_earth_station_image_exists(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *);
char *google_earth_station_get_image_tag(char *application_name, char *station,
                                         char *uname,
                                         char *document_root_directory) {
  static char image_tag[256];
  *image_tag = '\0';
  if (google_earth_station_image_exists(application_name, station)) {
    if (document_root_directory) {
      sprintf(
          image_tag,
          "<tr><td align=center><img border=2 src=%s/%s/%s/%s.png width=200>",
          document_root_directory + 1, application_name,
          "images/station_images_medium", station);
    } else {
      sprintf(image_tag,
              "<tr><td align=center><img border=2 src=http://%s/%s/%s/%s.png "
              "width=200>",
              uname, application_name, "images/station_images_medium", station);
    }
  }
  return image_tag;
}


x86 assembly (clang, -O0):
<google_earth_station_get_image_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movb   $0x0,0x2f01(%rip)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <google_earth_station_image_exists@plt>
cmp    $0x0,%rax
je     11bb <google_earth_station_get_image_tag+0x9b>
cmpq   $0x0,-0x20(%rbp)
je     1190 <google_earth_station_get_image_tag+0x70>
mov    -0x20(%rbp),%rdx
add    $0x1,%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r9
lea    0x2ec8(%rip),%rdi
lea    0xe81(%rip),%rsi
lea    0xebc(%rip),%r8
call   1040 <sprintf@plt>
jmp    11b6 <google_earth_station_get_image_tag+0x96>
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r9
lea    0x2e9d(%rip),%rdi
lea    0xeb5(%rip),%rsi
lea    0xe91(%rip),%r8
call   1040 <sprintf@plt>
jmp    11bb <google_earth_station_get_image_tag+0x9b>
lea    0x2e7e(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<google_earth_station_get_image_tag>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
movb   $0x0,0x2f05(%rip)
call   1030 <google_earth_station_image_exists@plt>
test   %rax,%rax
je     118b <google_earth_station_get_image_tag+0x6b>
test   %rbx,%rbx
je     1168 <google_earth_station_get_image_tag+0x48>
add    $0x1,%rbx
lea    0x2eeb(%rip),%rdi
lea    0xea4(%rip),%rsi
lea    0xedf(%rip),%r8
mov    %rbx,%rdx
jmp    1180 <google_earth_station_get_image_tag+0x60>
lea    0x2ed1(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xec5(%rip),%r8
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r9
call   1040 <sprintf@plt>
lea    0x2eae(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@google_earth_station_get_image_tag.image_tag = internal global [256 x i8] zeroinitializer
@.str = [66 x i8] c"<tr><td align=center><img border=2 src=%s/%s/%s/%s.png width=200>\00"
@.str.1 = [29 x i8] c"images/station_images_medium\00"
@.str.2 = [73 x i8] c"<tr><td align=center><img border=2 src=http://%s/%s/%s/%s.png width=200>\00"
define i8* @google_earth_station_get_image_tag(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i8 0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0)
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i64 @google_earth_station_image_exists(i8* %9, i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %4
%14 = load i8*, i8** %8
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i8*, i8** %8
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8*, i8** %5
%20 = load i8*, i8** %6
%21 = call i32 @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0), i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %27
22: ; preds = %13
%23 = load i8*, i8** %7
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = call i32 @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %24, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %22, %16
br label %28
28: ; preds = %27, %4
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0)
}

LLVM IR (-O2):
@google_earth_station_get_image_tag.image_tag = internal global [256 x i8] zeroinitializer
@.str = [66 x i8] c"<tr><td align=center><img border=2 src=%s/%s/%s/%s.png width=200>\00"
@.str.1 = [29 x i8] c"images/station_images_medium\00"
@.str.2 = [73 x i8] c"<tr><td align=center><img border=2 src=http://%s/%s/%s/%s.png width=200>\00"
define i8* @google_earth_station_get_image_tag(i8* %0, i8* %1, i8* %2, i8* %3) {
store i8 0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0)
%5 = tail call i64 @google_earth_station_image_exists(i8* %0, i8* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = icmp eq i8* %3, null
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8, i8* %3, i64 1
%11 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %14
12: ; preds = %7
%13 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %14
14: ; preds = %9, %12, %4
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @google_earth_station_get_image_tag.image_tag, i64 0, i64 0)
}