#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*/ getenv(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, char *);
int /*<<< orphan*/ strcmp(char *, char *);
scalar_t__ strlen(char *);
int write(int /*<<< orphan*/, char *, scalar_t__);
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) != (signed)(strlen(tbuf) + 1))
      perror("write");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe6c(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%eax
jne    11ae <main+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1347 <main+0x1d7>
cmpl   $0x1,-0x8(%rbp)
jg     11d7 <main+0x67>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe46(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1347 <main+0x1d7>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1340 <main+0x1d0>
mov    0x2dff(%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    0xe63(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1268 <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     1263 <main+0xf3>
movl   $0x2,-0x2c(%rbp)
jmp    1311 <main+0x1a1>
jmp    1268 <main+0xf8>
cmpl   $0x0,-0x18(%rbp)
je     129e <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    0xe04(%rip),%rdx
mov    $0x1b,%ecx
call   1070 <snprintf@plt>
jmp    12c5 <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    0xde0(%rip),%rdx
mov    $0x1b,%ecx
call   1070 <snprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
xor    %edi,%edi
call   1040 <write@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,-0x44(%rbp)
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x44(%rbp),%eax
add    $0x1,%rcx
cmp    %ecx,%eax
je     130a <main+0x19a>
lea    0xd9e(%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     132d <main+0x1bd>
jmp    1328 <main+0x1b8>
jmp    1340 <main+0x1d0>
jmp    1332 <main+0x1c2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11de <main+0x6e>
movl   $0x0,-0x4(%rbp)
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,-0x38(%rbp)
mov    %edi,-0x30(%rbp)
lea    0xe71(%rip),%rdi
call   1030 <getenv@plt>
test   %eax,%eax
je     12d5 <main+0x165>
cmpl   $0x2,-0x30(%rbp)
jge    11ba <main+0x4a>
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
lea    0xe5c(%rip),%rdi
call   1060 <printf@plt>
jmp    12d5 <main+0x165>
movl   $0x0,-0x2c(%rbp)
mov    $0x1,%r14d
jmp    1227 <main+0xb7>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r12d,%esi
lea    0xeb6(%rip),%rdx
mov    $0x1b,%ecx
mov    %r15,%r8
call   1070 <snprintf@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdx
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <write@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
cmp    %eax,%ebx
jne    12c1 <main+0x151>
mov    -0x40(%rbp),%rsp
add    $0x1,%r14d
cmp    -0x30(%rbp),%r14d
jge    12d5 <main+0x165>
mov    %rsp,%rbx
mov    0x2dbf(%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    -0x38(%rbp),%rcx
mov    (%rcx,%rax,8),%r15
mov    %r15,%rdi
lea    0xe33(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
mov    %rbx,-0x40(%rbp)
je     12a0 <main+0x130>
cmpl   $0x0,-0x2c(%rbp)
jne    11d0 <main+0x60>
mov    %r13,%rdi
mov    %r12d,%esi
lea    0xe1a(%rip),%rdx
mov    $0x1b,%ecx
mov    %r15,%r8
call   1070 <snprintf@plt>
movl   $0x0,-0x2c(%rbp)
jmp    11ea <main+0x7a>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14d
cmp    -0x30(%rbp),%r14d
jge    12d2 <main+0x162>
movslq %r14d,%rax
mov    -0x38(%rbp),%rcx
mov    (%rcx,%rax,8),%r15
movl   $0x1,-0x2c(%rbp)
jmp    11d0 <main+0x60>
lea    0xddb(%rip),%rdi
call   1090 <perror@plt>
jmp    1215 <main+0xa5>
mov    %rbx,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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 %85
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 %85
22: ; preds = %14
store i32 1, i32* %6
br label %23
23: ; preds = %81, %22
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %84
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 %77
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 i64 @strlen(i8* %31)
%68 = add nsw i64 %67, 1
%69 = call i32 @write(i32 0, i8* %31, i64 %68)
%70 = call i64 @strlen(i8* %31)
%71 = add nsw i64 %70, 1
%72 = trunc i64 %71 to i32
%73 = icmp ne i32 %69, %72
br i1 %73, label %74, label %76
74: ; preds = %66
%75 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %74, %66
store i32 0, i32* %10
br label %77
77: ; preds = %76, %45
%78 = load i8*, i8** %8
%79 = load i32, i32* %10
switch i32 %79, label %87 [
i32 0, label %80
i32 2, label %84
]
80: ; preds = %77
br label %81
81: ; preds = %80
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %23
84: ; preds = %77, %23
store i32 0, i32* %3
br label %85
85: ; preds = %84, %17, %13
%86 = load i32, i32* %3
ret i32 %86
87: ; preds = %77
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 %54, 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 %54
10: ; preds = %5, %51
%11 = phi i32 [ %52, %51 ], [ 1, %5 ]
%12 = phi i32 [ %40, %51 ], [ 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 %50
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 i64 @strlen(i8* %16)
%42 = add nsw i64 %41, 1
%43 = call i32 @write(i32 0, i8* %16, i64 %42)
%44 = call i64 @strlen(i8* %16)
%45 = trunc i64 %44 to i32
%46 = add i32 %45, 1
%47 = icmp eq i32 %43, %46
br i1 %47, label %51, label %48
48: ; preds = %38
%49 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %51
50: ; preds = %22
br label %54
51: ; preds = %48, %38
%52 = add nsw i32 %39, 1
%53 = icmp slt i32 %52, %0
br i1 %53, label %10, label %54
54: ; preds = %51, %50, %2, %7
ret i32 0
}