#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 */
char *basename(char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
scalar_t__ strlen(char const *);
scalar_t__ strncmp(char *, char *, int);
void gui_window_set_title(const char *title) {
  char *shell, *shellname;
  char *envterm = getenv("TERM");
  char *envshell = getenv("SHELL");
  if (envterm) {
    if (title && title[0]) {
      if (strcmp(envterm, "sun-cmd") == 0) {
        printf("\033]l%s\033\\", title);
      } else if (strcmp(envterm, "hpterm") == 0) {
        printf("\033&f0k%dD%s", (int)(strlen(title) + 1), title);
      } else if ((strncmp(envterm, "xterm", 5) == 0) ||
                 (strncmp(envterm, "rxvt", 4) == 0) ||
                 (strcmp(envterm, "Eterm") == 0) ||
                 (strcmp(envterm, "aixterm") == 0) ||
                 (strcmp(envterm, "iris-ansi") == 0) ||
                 (strcmp(envterm, "dtterm") == 0)) {
        printf("\33]0;%s\7", title);
      } else if (strcmp(envterm, "screen") == 0) {
        printf("\033k%s\033\\", title);
        printf("\33]0;%s\7", title);
      }
    } else {
      if (strcmp(envterm, "sun-cmd") == 0) {
        printf("\033]l%s\033\\", "Terminal");
      } else if (strcmp(envterm, "hpterm") == 0) {
        printf("\033&f0k%dD%s", (int)strlen("Terminal"), "Terminal");
      } else if ((strncmp(envterm, "xterm", 5) == 0) ||
                 (strncmp(envterm, "rxvt", 4) == 0) ||
                 (strcmp(envterm, "Eterm") == 0) ||
                 (strcmp(envterm, "aixterm") == 0) ||
                 (strcmp(envterm, "iris-ansi") == 0) ||
                 (strcmp(envterm, "dtterm") == 0)) {
        printf("\33]0;%s\7", "Terminal");
      } else if (strcmp(envterm, "screen") == 0) {
        if (envshell) {
          shell = strdup(envshell);
          if (shell) {
            shellname = basename(shell);
            printf("\033k%s\033\\", (shellname) ? shellname : shell);
            free(shell);
          } else {
            printf("\033k%s\033\\", envterm);
          }
        } else {
          printf("\033k%s\033\\", envterm);
        }
        printf("\33]0;%s\7", "Terminal");
      }
    }
  }
}


x86 assembly (clang, -O0):
<gui_window_set_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe6d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
lea    0xe62(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1569 <gui_window_set_title+0x3e9>
cmpq   $0x0,-0x8(%rbp)
je     1352 <gui_window_set_title+0x1d2>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1352 <gui_window_set_title+0x1d2>
mov    -0x20(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1203 <gui_window_set_title+0x83>
mov    -0x8(%rbp),%rsi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    134d <gui_window_set_title+0x1cd>
mov    -0x20(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1243 <gui_window_set_title+0xc3>
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
add    $0x1,%rax
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1348 <gui_window_set_title+0x1c8>
mov    -0x20(%rbp),%rdi
lea    0xdec(%rip),%rsi
mov    $0x5,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     12e9 <gui_window_set_title+0x169>
mov    -0x20(%rbp),%rdi
lea    0xdc0(%rip),%rsi
mov    $0x4,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     12e9 <gui_window_set_title+0x169>
mov    -0x20(%rbp),%rdi
lea    0xda6(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     12e9 <gui_window_set_title+0x169>
mov    -0x20(%rbp),%rdi
lea    0xd92(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     12e9 <gui_window_set_title+0x169>
mov    -0x20(%rbp),%rdi
lea    0xd80(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     12e9 <gui_window_set_title+0x169>
mov    -0x20(%rbp),%rdi
lea    0xd70(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1300 <gui_window_set_title+0x180>
mov    -0x8(%rbp),%rsi
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1343 <gui_window_set_title+0x1c3>
mov    -0x20(%rbp),%rdi
lea    0xd4e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    133e <gui_window_set_title+0x1be>
mov    -0x8(%rbp),%rsi
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1343 <gui_window_set_title+0x1c3>
jmp    1348 <gui_window_set_title+0x1c8>
jmp    134d <gui_window_set_title+0x1cd>
jmp    1564 <gui_window_set_title+0x3e4>
mov    -0x20(%rbp),%rdi
lea    0xcae(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1386 <gui_window_set_title+0x206>
lea    0xca0(%rip),%rdi
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    155f <gui_window_set_title+0x3df>
mov    -0x20(%rbp),%rdi
lea    0xc8a(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    13c8 <gui_window_set_title+0x248>
lea    0xcc0(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%esi
lea    0xc6d(%rip),%rdi
lea    0xcab(%rip),%rdx
mov    $0x0,%al
call   1070 <printf@plt>
jmp    155a <gui_window_set_title+0x3da>
mov    -0x20(%rbp),%rdi
lea    0xc67(%rip),%rsi
mov    $0x5,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     146e <gui_window_set_title+0x2ee>
mov    -0x20(%rbp),%rdi
lea    0xc3b(%rip),%rsi
mov    $0x4,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     146e <gui_window_set_title+0x2ee>
mov    -0x20(%rbp),%rdi
lea    0xc21(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     146e <gui_window_set_title+0x2ee>
mov    -0x20(%rbp),%rdi
lea    0xc0d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     146e <gui_window_set_title+0x2ee>
mov    -0x20(%rbp),%rdi
lea    0xbfb(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     146e <gui_window_set_title+0x2ee>
mov    -0x20(%rbp),%rdi
lea    0xbeb(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1488 <gui_window_set_title+0x308>
lea    0xbdc(%rip),%rdi
lea    0xbeb(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1555 <gui_window_set_title+0x3d5>
mov    -0x20(%rbp),%rdi
lea    0xbc6(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1550 <gui_window_set_title+0x3d0>
cmpq   $0x0,-0x28(%rbp)
je     1529 <gui_window_set_title+0x3a9>
mov    -0x28(%rbp),%rdi
call   10a0 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1512 <gui_window_set_title+0x392>
mov    -0x10(%rbp),%rdi
call   1090 <basename@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     14ea <gui_window_set_title+0x36a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    14f2 <gui_window_set_title+0x372>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xb63(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
jmp    1524 <gui_window_set_title+0x3a4>
mov    -0x20(%rbp),%rsi
lea    0xb43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    153b <gui_window_set_title+0x3bb>
mov    -0x20(%rbp),%rsi
lea    0xb2c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xb0f(%rip),%rdi
lea    0xb1e(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1555 <gui_window_set_title+0x3d5>
jmp    155a <gui_window_set_title+0x3da>
jmp    155f <gui_window_set_title+0x3df>
jmp    1564 <gui_window_set_title+0x3e4>
jmp    1569 <gui_window_set_title+0x3e9>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_window_set_title>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xe71(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xe67(%rip),%rdi
call   1030 <getenv@plt>
test   %rbx,%rbx
je     138b <gui_window_set_title+0x20b>
mov    %rax,%r15
test   %r14,%r14
je     12ad <gui_window_set_title+0x12d>
cmpb   $0x0,(%r14)
je     12ad <gui_window_set_title+0x12d>
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     139d <gui_window_set_title+0x21d>
lea    0xe3a(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     13c1 <gui_window_set_title+0x241>
lea    0xe41(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     12a1 <gui_window_set_title+0x121>
lea    0xe17(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     12a1 <gui_window_set_title+0x121>
lea    0xe03(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12a1 <gui_window_set_title+0x121>
lea    0xdf5(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12a1 <gui_window_set_title+0x121>
lea    0xde9(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12a1 <gui_window_set_title+0x121>
lea    0xddf(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12a1 <gui_window_set_title+0x121>
lea    0xdda(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    138b <gui_window_set_title+0x20b>
lea    0xdc9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xda9(%rip),%rdi
jmp    13a4 <gui_window_set_title+0x224>
lea    0xd57(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1391 <gui_window_set_title+0x211>
lea    0xd4f(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     13ac <gui_window_set_title+0x22c>
lea    0xd56(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     1432 <gui_window_set_title+0x2b2>
lea    0xd2c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     1432 <gui_window_set_title+0x2b2>
lea    0xd14(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1432 <gui_window_set_title+0x2b2>
lea    0xd02(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1432 <gui_window_set_title+0x2b2>
lea    0xcf2(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1432 <gui_window_set_title+0x2b2>
lea    0xce4(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1432 <gui_window_set_title+0x2b2>
lea    0xcdb(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     13e2 <gui_window_set_title+0x262>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xc7b(%rip),%rdi
jmp    1439 <gui_window_set_title+0x2b9>
lea    0xc6f(%rip),%rdi
mov    %r14,%rsi
jmp    1440 <gui_window_set_title+0x2c0>
lea    0xc6f(%rip),%rdi
lea    0xcad(%rip),%rdx
mov    $0x8,%esi
jmp    13d6 <gui_window_set_title+0x256>
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%esi
lea    0xc4f(%rip),%rdi
mov    %r14,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <printf@plt>
test   %r15,%r15
je     1421 <gui_window_set_title+0x2a1>
mov    %r15,%rdi
call   10a0 <strdup@plt>
test   %rax,%rax
je     1421 <gui_window_set_title+0x2a1>
mov    %rax,%r14
mov    %rax,%rdi
call   1090 <basename@plt>
test   %rax,%rax
mov    %r14,%rsi
cmovne %rax,%rsi
lea    0xc50(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   1040 <free@plt>
jmp    1432 <gui_window_set_title+0x2b2>
lea    0xc38(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc18(%rip),%rdi
lea    0xc27(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"TERM\00"
@.str.1 = [6 x i8] c"SHELL\00"
@.str.2 = [8 x i8] c"sun-cmd\00"
@.str.3 = [8 x i8] c"\1B]l%s\1B\\\00"
@.str.4 = [7 x i8] c"hpterm\00"
@.str.5 = [11 x i8] c"\1B&f0k%dD%s\00"
@.str.6 = [6 x i8] c"xterm\00"
@.str.7 = [5 x i8] c"rxvt\00"
@.str.8 = [6 x i8] c"Eterm\00"
@.str.9 = [8 x i8] c"aixterm\00"
@.str.10 = [10 x i8] c"iris-ansi\00"
@.str.11 = [7 x i8] c"dtterm\00"
@.str.12 = [8 x i8] c"\1B]0;%s\07\00"
@.str.13 = [7 x i8] c"screen\00"
@.str.14 = [7 x i8] c"\1Bk%s\1B\\\00"
@.str.15 = [9 x i8] c"Terminal\00"
define void @gui_window_set_title(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %2
%7 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %158
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %78
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %78
20: ; preds = %14
%21 = load i8*, i8** %5
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i8*, i8** %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %77
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %27
%32 = load i8*, i8** %2
%33 = call i64 @strlen(i8* %32)
%34 = add nsw i64 %33, 1
%35 = trunc i64 %34 to i32
%36 = load i8*, i8** %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %35, i8* %36)
br label %76
38: ; preds = %27
%39 = load i8*, i8** %5
%40 = call i64 @strncmp(i8* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%41 = icmp eq i64 %40, 0
br i1 %41, label %62, label %42
42: ; preds = %38
%43 = load i8*, i8** %5
%44 = call i64 @strncmp(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%45 = icmp eq i64 %44, 0
br i1 %45, label %62, label %46
46: ; preds = %42
%47 = load i8*, i8** %5
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %62, label %50
50: ; preds = %46
%51 = load i8*, i8** %5
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %62, label %54
54: ; preds = %50
%55 = load i8*, i8** %5
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %54
%59 = load i8*, i8** %5
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %58, %54, %50, %46, %42, %38
%63 = load i8*, i8** %2
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %63)
br label %75
65: ; preds = %58
%66 = load i8*, i8** %5
%67 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %74
69: ; preds = %65
%70 = load i8*, i8** %2
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %70)
%72 = load i8*, i8** %2
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %72)
br label %74
74: ; preds = %69, %65
br label %75
75: ; preds = %74, %62
br label %76
76: ; preds = %75, %31
br label %77
77: ; preds = %76, %24
br label %157
78: ; preds = %14, %11
%79 = load i8*, i8** %5
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %156
84: ; preds = %78
%85 = load i8*, i8** %5
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %92
88: ; preds = %84
%89 = call i64 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
%90 = trunc i64 %89 to i32
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %90, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %155
92: ; preds = %84
%93 = load i8*, i8** %5
%94 = call i64 @strncmp(i8* %93, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%95 = icmp eq i64 %94, 0
br i1 %95, label %116, label %96
96: ; preds = %92
%97 = load i8*, i8** %5
%98 = call i64 @strncmp(i8* %97, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%99 = icmp eq i64 %98, 0
br i1 %99, label %116, label %100
100: ; preds = %96
%101 = load i8*, i8** %5
%102 = call i64 @strcmp(i8* %101, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%103 = icmp eq i64 %102, 0
br i1 %103, label %116, label %104
104: ; preds = %100
%105 = load i8*, i8** %5
%106 = call i64 @strcmp(i8* %105, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%107 = icmp eq i64 %106, 0
br i1 %107, label %116, label %108
108: ; preds = %104
%109 = load i8*, i8** %5
%110 = call i64 @strcmp(i8* %109, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%111 = icmp eq i64 %110, 0
br i1 %111, label %116, label %112
112: ; preds = %108
%113 = load i8*, i8** %5
%114 = call i64 @strcmp(i8* %113, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %118
116: ; preds = %112, %108, %104, %100, %96, %92
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %154
118: ; preds = %112
%119 = load i8*, i8** %5
%120 = call i64 @strcmp(i8* %119, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %153
122: ; preds = %118
%123 = load i8*, i8** %6
%124 = icmp ne i8* %123, null
br i1 %124, label %125, label %148
125: ; preds = %122
%126 = load i8*, i8** %6
%127 = call i8* @strdup(i8* %126)
store i8* %127, i8** %3
%128 = load i8*, i8** %3
%129 = icmp ne i8* %128, null
br i1 %129, label %130, label %144
130: ; preds = %125
%131 = load i8*, i8** %3
%132 = call i8* @basename(i8* %131)
store i8* %132, i8** %4
%133 = load i8*, i8** %4
%134 = icmp ne i8* %133, null
br i1 %134, label %135, label %137
135: ; preds = %130
%136 = load i8*, i8** %4
br label %139
137: ; preds = %130
%138 = load i8*, i8** %3
br label %139
139: ; preds = %137, %135
%140 = phi i8* [ %136, %135 ], [ %138, %137 ]
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %140)
%142 = load i8*, i8** %3
%143 = call i32 @free(i8* %142)
br label %147
144: ; preds = %125
%145 = load i8*, i8** %5
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %145)
br label %147
147: ; preds = %144, %139
br label %151
148: ; preds = %122
%149 = load i8*, i8** %5
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %149)
br label %151
151: ; preds = %148, %147
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %153
153: ; preds = %151, %118
br label %154
154: ; preds = %153, %116
br label %155
155: ; preds = %154, %88
br label %156
156: ; preds = %155, %82
br label %157
157: ; preds = %156, %77
br label %158
158: ; preds = %157, %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"TERM\00"
@.str.1 = [6 x i8] c"SHELL\00"
@.str.2 = [8 x i8] c"sun-cmd\00"
@.str.3 = [8 x i8] c"\1B]l%s\1B\\\00"
@.str.4 = [7 x i8] c"hpterm\00"
@.str.5 = [11 x i8] c"\1B&f0k%dD%s\00"
@.str.6 = [6 x i8] c"xterm\00"
@.str.7 = [5 x i8] c"rxvt\00"
@.str.8 = [6 x i8] c"Eterm\00"
@.str.9 = [8 x i8] c"aixterm\00"
@.str.10 = [10 x i8] c"iris-ansi\00"
@.str.11 = [7 x i8] c"dtterm\00"
@.str.12 = [8 x i8] c"\1B]0;%s\07\00"
@.str.13 = [7 x i8] c"screen\00"
@.str.14 = [7 x i8] c"\1Bk%s\1B\\\00"
@.str.15 = [9 x i8] c"Terminal\00"
define void @gui_window_set_title(i8* %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i8* %2, null
br i1 %4, label %99, label %5
5: ; preds = %1
%6 = icmp eq i8* %0, null
br i1 %6, label %49, label %7
7: ; preds = %5
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %49, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %99
15: ; preds = %10
%16 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = tail call i64 @strlen(i8* %0)
%20 = trunc i64 %19 to i32
%21 = add i32 %20, 1
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %21, i8* %0)
br label %99
23: ; preds = %15
%24 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%25 = icmp eq i64 %24, 0
br i1 %25, label %41, label %26
26: ; preds = %23
%27 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%28 = icmp eq i64 %27, 0
br i1 %28, label %41, label %29
29: ; preds = %26
%30 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %41, label %32
32: ; preds = %29
%33 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %32
%36 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38, %35, %32, %29, %26, %23
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %0)
br label %99
43: ; preds = %38
%44 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %99
46: ; preds = %43
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %0)
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %0)
br label %99
49: ; preds = %7, %5
%50 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %99
54: ; preds = %49
%55 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %99
59: ; preds = %54
%60 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%61 = icmp eq i64 %60, 0
br i1 %61, label %77, label %62
62: ; preds = %59
%63 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%64 = icmp eq i64 %63, 0
br i1 %64, label %77, label %65
65: ; preds = %62
%66 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %77, label %68
68: ; preds = %65
%69 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %77, label %71
71: ; preds = %68
%72 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %71
%75 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74, %71, %68, %65, %62, %59
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %99
79: ; preds = %74
%80 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %99
82: ; preds = %79
%83 = icmp eq i8* %3, null
br i1 %83, label %95, label %84
84: ; preds = %82
%85 = tail call i8* @strdup(i8* %3)
%86 = icmp eq i8* %85, null
br i1 %86, label %93, label %87
87: ; preds = %84
%88 = tail call i8* @basename(i8* %85)
%89 = icmp eq i8* %88, null
%90 = select i1 %89, i8* %85, i8* %88
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %90)
%92 = tail call i32 @free(i8* %85)
br label %97
93: ; preds = %84
%94 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %2)
br label %97
95: ; preds = %82
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %2)
br label %97
97: ; preds = %87, %93, %95
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %99
99: ; preds = %18, %43, %46, %41, %13, %57, %79, %97, %77, %52, %1
ret void
}