#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 *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  const char *env;
  printf("Device: TCP socket\n");
  printf("Virtual TPM communication disabled\n");
  env = getenv("TPM_SERVER_PORT");
  if (env == NULL) {
    printf("TPM_SERVER_PORT not set\n");
  } else {
    printf("TPM_SERVER_PORT %s\n", env);
  }
  env = getenv("TPM_SERVER_NAME");
  if (env == NULL) {
    printf("TPM_SERVER_NAME not set\n");
  } else {
    printf("TPM_SERVER_NAME %s\n", env);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <main+0x60>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1192 <main+0x72>
mov    -0x18(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c0 <main+0xa0>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d2 <main+0xb2>
mov    -0x18(%rbp),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf10(%rip),%rdi
call   1040 <puts@plt>
lea    0xf17(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     116d <main+0x3d>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1179 <main+0x49>
lea    0xf22(%rip),%rdi
call   1040 <puts@plt>
lea    0xea4(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     119d <main+0x6d>
lea    0xea3(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11a9 <main+0x79>
lea    0xeda(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Device: TCP socket\0A\00"
@.str.1 = [36 x i8] c"Virtual TPM communication disabled\0A\00"
@.str.2 = [16 x i8] c"TPM_SERVER_PORT\00"
@.str.3 = [25 x i8] c"TPM_SERVER_PORT not set\0A\00"
@.str.4 = [20 x i8] c"TPM_SERVER_PORT %s\0A\00"
@.str.5 = [16 x i8] c"TPM_SERVER_NAME\00"
@.str.6 = [25 x i8] c"TPM_SERVER_NAME not set\0A\00"
@.str.7 = [20 x i8] c"TPM_SERVER_NAME %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%11 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %19
16: ; preds = %2
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %14
%20 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %28
25: ; preds = %19
%26 = load i8*, i8** %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %23
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c"TPM_SERVER_PORT\00"
@.str.4 = [20 x i8] c"TPM_SERVER_PORT %s\0A\00"
@.str.5 = [16 x i8] c"TPM_SERVER_NAME\00"
@.str.7 = [20 x i8] c"TPM_SERVER_NAME %s\0A\00"
@str = [19 x i8] c"Device: TCP socket\00"
@str.8 = [35 x i8] c"Virtual TPM communication disabled\00"
@str.9 = [24 x i8] c"TPM_SERVER_NAME not set\00"
@str.10 = [24 x i8] c"TPM_SERVER_PORT not set\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
br label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %5)
br label %11
11: ; preds = %9, %7
%12 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %12)
br label %18
18: ; preds = %16, %14
ret i32 0
}