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

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int write(int /*<<< orphan*/, char *, int);
int main(int argc, char **argv) {
  int i, perm = 0;
  if (!getenv("TERMINOLOGY"))
    return 0;
  if (argc <= 1) {
    printf("Usage: %s [-p] on|off|<opacity level>\n"
           "  Change the terminal transparency on or off\n"
           "  -p  Make change permanent (stored in config)\n"
           "\n",
           argv[0]);
    return 0;
  }
  for (i = 1; i < argc; i++) {
    char tbuf[PATH_MAX];
    if (!strcmp(argv[i], "-p")) {
      perm = 1;
      i++;
      if (i >= argc)
        break;
    }
    if (perm)
      snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
    else
      snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
    if (write(0, tbuf, strlen(tbuf)) < 1)
      perror("write");
    tbuf[0] = 0;
    if (write(0, tbuf, 1) < 1)
      perror("write");
  }
  exit(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe5c(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%eax
jne    11be <main+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1365 <main+0x1e5>
cmpl   $0x1,-0x8(%rbp)
jg     11e7 <main+0x67>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe36(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1365 <main+0x1e5>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    135e <main+0x1de>
mov    0x2def(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x40(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe53(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1278 <main+0xf8>
movl   $0x1,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1273 <main+0xf3>
movl   $0x2,-0x2c(%rbp)
jmp    132f <main+0x1af>
jmp    1278 <main+0xf8>
cmpl   $0x0,-0x18(%rbp)
je     12ae <main+0x12e>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
lea    0xdf4(%rip),%rdx
mov    $0x1b,%ecx
call   1070 <snprintf@plt>
jmp    12d5 <main+0x155>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
lea    0xdd0(%rip),%rdx
mov    $0x1b,%ecx
call   1070 <snprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
xor    %edi,%edi
call   1040 <write@plt>
cmp    $0x1,%eax
jge    1300 <main+0x180>
lea    0xda8(%rip),%rdi
call   1090 <perror@plt>
mov    -0x38(%rbp),%rsi
movb   $0x0,(%rsi)
xor    %edi,%edi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%eax
jge    1328 <main+0x1a8>
lea    0xd80(%rip),%rdi
call   1090 <perror@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x2c(%rbp),%eax
test   %eax,%eax
je     134b <main+0x1cb>
jmp    1346 <main+0x1c6>
jmp    135e <main+0x1de>
jmp    1350 <main+0x1d0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ee <main+0x6e>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xe63(%rip),%rdi
call   1030 <getenv@plt>
test   %eax,%eax
je     11ba <main+0x3a>
cmp    $0x2,%ebx
jge    11cb <main+0x4b>
mov    (%r15),%rsi
lea    0xe57(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebx,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    $0x1,%r14d
mov    %r15,-0x40(%rbp)
jmp    1201 <main+0x81>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rsp
add    $0x1,%r14d
cmp    -0x30(%rbp),%r14d
jge    12ff <main+0x17f>
mov    %rsp,-0x38(%rbp)
mov    0x2de4(%rip),%rax
mov    (%rax),%r12d
mov    %rsp,%r13
mov    %r12,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
movslq %r14d,%rax
mov    (%r15,%rax,8),%r15
mov    %r15,%rdi
lea    0xe5c(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     126a <main+0xea>
cmpl   $0x0,-0x2c(%rbp)
jne    128a <main+0x10a>
mov    %r13,%rdi
mov    %r12d,%esi
lea    0xe4b(%rip),%rdx
mov    $0x1b,%ecx
mov    %r15,%r8
call   1070 <snprintf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rbx
jmp    12a8 <main+0x128>
add    $0x1,%r14d
cmp    -0x30(%rbp),%r14d
jge    1306 <main+0x186>
movslq %r14d,%rax
mov    -0x40(%rbp),%rcx
mov    (%rcx,%rax,8),%r15
movl   $0x1,-0x2c(%rbp)
mov    -0x38(%rbp),%rbx
mov    %r13,%rdi
mov    %r12d,%esi
lea    0xdf8(%rip),%rdx
mov    $0x1b,%ecx
mov    %r15,%r8
call   1070 <snprintf@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
xor    %edi,%edi
mov    %r13,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
mov    -0x40(%rbp),%r15
jle    12f1 <main+0x171>
movb   $0x0,0x0(%r13)
xor    %edi,%edi
mov    %r13,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
test   %eax,%eax
jg     11f0 <main+0x70>
lea    0xdbc(%rip),%rdi
call   1090 <perror@plt>
jmp    11f0 <main+0x70>
lea    0xdab(%rip),%rdi
call   1090 <perror@plt>
jmp    12c4 <main+0x144>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x38(%rbp),%rsp
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"TERMINOLOGY\00"
@.str.1 = [132 x i8] c"Usage: %s [-p] on|off|<opacity level>\0A Change the terminal transparency on or off\0A -p Make change permanent (stored in config)\0A\0A\00"
@PATH_MAX = global i32 0
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [8 x i8] c"%c}ap%s\00"
@.str.4 = [8 x i8] c"%c}at%s\00"
@.str.5 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%11 = call i32 @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %2
store i32 0, i32* %3
br label %88
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp sle i32 %15, 1
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str.1, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %88
22: ; preds = %14
store i32 1, i32* %6
br label %23
23: ; preds = %83, %22
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %86
27: ; preds = %23
%28 = load i32, i32* @PATH_MAX
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %8
%31 = alloca i8, i64 %29
store i64 %29, i64* %9
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %47, label %39
39: ; preds = %27
store i32 1, i32* %7
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
%42 = load i32, i32* %6
%43 = load i32, i32* %4
%44 = icmp sge i32 %42, %43
br i1 %44, label %45, label %46
45: ; preds = %39
store i32 2, i32* %10
br label %79
46: ; preds = %39
br label %47
47: ; preds = %46, %27
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %58
50: ; preds = %47
%51 = trunc i64 %29 to i32
%52 = load i8**, i8*** %5
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @snprintf(i8* %31, i32 %51, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 27, i8* %56)
br label %66
58: ; preds = %47
%59 = trunc i64 %29 to i32
%60 = load i8**, i8*** %5
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 @snprintf(i8* %31, i32 %59, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 27, i8* %64)
br label %66
66: ; preds = %58, %50
%67 = call i32 @strlen(i8* %31)
%68 = call i32 @write(i32 0, i8* %31, i32 %67)
%69 = icmp slt i32 %68, 1
br i1 %69, label %70, label %72
70: ; preds = %66
%71 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %70, %66
%73 = getelementptr inbounds i8, i8* %31, i64 0
store i8 0, i8* %73
%74 = call i32 @write(i32 0, i8* %31, i32 1)
%75 = icmp slt i32 %74, 1
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %78
78: ; preds = %76, %72
store i32 0, i32* %10
br label %79
79: ; preds = %78, %45
%80 = load i8*, i8** %8
%81 = load i32, i32* %10
switch i32 %81, label %90 [
i32 0, label %82
i32 2, label %86
]
82: ; preds = %79
br label %83
83: ; preds = %82
%84 = load i32, i32* %6
%85 = add nsw i32 %84, 1
store i32 %85, i32* %6
br label %23
86: ; preds = %79, %23
%87 = call i32 @exit(i32 0)
unreachable
88: ; preds = %17, %13
%89 = load i32, i32* %3
ret i32 %89
90: ; preds = %79
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"TERMINOLOGY\00"
@.str.1 = [132 x i8] c"Usage: %s [-p] on|off|<opacity level>\0A Change the terminal transparency on or off\0A -p Make change permanent (stored in config)\0A\0A\00"
@PATH_MAX = global i32 0
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [8 x i8] c"%c}ap%s\00"
@.str.4 = [8 x i8] c"%c}at%s\00"
@.str.5 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %57, label %5
5: ; preds = %2
%6 = icmp slt i32 %0, 2
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = load i8*, i8** %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %57
10: ; preds = %5, %52
%11 = phi i32 [ %53, %52 ], [ 1, %5 ]
%12 = phi i32 [ %40, %52 ], [ 0, %5 ]
%13 = load i32, i32* @PATH_MAX
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i8, i64 %14
%17 = sext i32 %11 to i64
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %10
%23 = add nsw i32 %11, 1
%24 = icmp slt i32 %23, %0
br i1 %24, label %25, label %51
25: ; preds = %22
%26 = sext i32 %23 to i64
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
br label %31
29: ; preds = %10
%30 = icmp eq i32 %12, 0
br i1 %30, label %36, label %31
31: ; preds = %25, %29
%32 = phi i8* [ %19, %29 ], [ %28, %25 ]
%33 = phi i32 [ %11, %29 ], [ %23, %25 ]
%34 = phi i32 [ %12, %29 ], [ 1, %25 ]
%35 = call i32 @snprintf(i8* %16, i32 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 27, i8* %32)
br label %38
36: ; preds = %29
%37 = call i32 @snprintf(i8* %16, i32 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 27, i8* %19)
br label %38
38: ; preds = %36, %31
%39 = phi i32 [ %11, %36 ], [ %33, %31 ]
%40 = phi i32 [ 0, %36 ], [ %34, %31 ]
%41 = call i32 @strlen(i8* %16)
%42 = call i32 @write(i32 0, i8* %16, i32 %41)
%43 = icmp slt i32 %42, 1
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %44, %38
store i8 0, i8* %16
%47 = call i32 @write(i32 0, i8* %16, i32 1)
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %52
51: ; preds = %22
br label %55
52: ; preds = %49, %46
%53 = add nsw i32 %39, 1
%54 = icmp slt i32 %53, %0
br i1 %54, label %10, label %55
55: ; preds = %52, %51
%56 = call i32 @exit(i32 0)
unreachable
57: ; preds = %2, %7
ret i32 0
}