#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__ strcmp(char const *, char *);
int sys_setenv(char const *, char const *);
int block_setenv(const char *name, const char *value, void *data) {
  int err;
  if (!value)
    value = "";
  err = sys_setenv(name, value);
  if (err)
    return err;
  if (strcmp(name, "name") == 0)
    return sys_setenv("BLOCK_NAME", value);
  if (strcmp(name, "instance") == 0)
    return sys_setenv("BLOCK_INSTANCE", value);
  if (strcmp(name, "interval") == 0)
    return sys_setenv("BLOCK_INTERVAL", value);
  if (strcmp(name, "button") == 0)
    return sys_setenv("BLOCK_BUTTON", value);
  if (strcmp(name, "x") == 0)
    return sys_setenv("BLOCK_X", value);
  if (strcmp(name, "y") == 0)
    return sys_setenv("BLOCK_Y", value);
  return 0;
}


x86 assembly (clang, -O0):
<block_setenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114a <block_setenv+0x2a>
lea    0xee1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <sys_setenv@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     116f <block_setenv+0x4f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
mov    -0x10(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a1 <block_setenv+0x81>
mov    -0x18(%rbp),%rsi
lea    0xe71(%rip),%rdi
call   1030 <sys_setenv@plt>
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
mov    -0x10(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d3 <block_setenv+0xb3>
mov    -0x18(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1030 <sys_setenv@plt>
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
mov    -0x10(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1205 <block_setenv+0xe5>
mov    -0x18(%rbp),%rsi
lea    0xe39(%rip),%rdi
call   1030 <sys_setenv@plt>
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
mov    -0x10(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1237 <block_setenv+0x117>
mov    -0x18(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1030 <sys_setenv@plt>
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
mov    -0x10(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1269 <block_setenv+0x149>
mov    -0x18(%rbp),%rsi
lea    0xdfa(%rip),%rdi
call   1030 <sys_setenv@plt>
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
mov    -0x10(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    129b <block_setenv+0x17b>
mov    -0x18(%rbp),%rsi
lea    0xdd2(%rip),%rdi
call   1030 <sys_setenv@plt>
mov    %eax,-0x4(%rbp)
jmp    12a2 <block_setenv+0x182>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_setenv>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rsi,%rsi
lea    0xef6(%rip),%rbx
cmovne %rsi,%rbx
mov    %rbx,%rsi
call   1030 <sys_setenv@plt>
test   %eax,%eax
je     1149 <block_setenv+0x29>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xeb0(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11d3 <block_setenv+0xb3>
lea    0xeac(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11dc <block_setenv+0xbc>
lea    0xeb0(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e5 <block_setenv+0xc5>
lea    0xeb4(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11ee <block_setenv+0xce>
lea    0xeb4(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11f7 <block_setenv+0xd7>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1141 <block_setenv+0x21>
lea    0xe8f(%rip),%rdi
jmp    11fe <block_setenv+0xde>
lea    0xe2b(%rip),%rdi
jmp    11fe <block_setenv+0xde>
lea    0xe36(%rip),%rdi
jmp    11fe <block_setenv+0xde>
lea    0xe45(%rip),%rdi
jmp    11fe <block_setenv+0xde>
lea    0xe52(%rip),%rdi
jmp    11fe <block_setenv+0xde>
lea    0xe58(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <sys_setenv@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"name\00"
@.str.2 = [11 x i8] c"BLOCK_NAME\00"
@.str.3 = [9 x i8] c"instance\00"
@.str.4 = [15 x i8] c"BLOCK_INSTANCE\00"
@.str.5 = [9 x i8] c"interval\00"
@.str.6 = [15 x i8] c"BLOCK_INTERVAL\00"
@.str.7 = [7 x i8] c"button\00"
@.str.8 = [13 x i8] c"BLOCK_BUTTON\00"
@.str.9 = [2 x i8] c"x\00"
@.str.10 = [8 x i8] c"BLOCK_X\00"
@.str.11 = [2 x i8] c"y\00"
@.str.12 = [8 x i8] c"BLOCK_Y\00"
define i32 @block_setenv(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
br label %12
12: ; preds = %11, %3
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @sys_setenv(i8* %13, i8* %14)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = load i32, i32* %8
store i32 %19, i32* %4
br label %63
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i8*, i8** %6
%26 = call i32 @sys_setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %25)
store i32 %26, i32* %4
br label %63
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i8*, i8** %6
%33 = call i32 @sys_setenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %32)
store i32 %33, i32* %4
br label %63
34: ; preds = %27
%35 = load i8*, i8** %5
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i8*, i8** %6
%40 = call i32 @sys_setenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %39)
store i32 %40, i32* %4
br label %63
41: ; preds = %34
%42 = load i8*, i8** %5
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i8*, i8** %6
%47 = call i32 @sys_setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %46)
store i32 %47, i32* %4
br label %63
48: ; preds = %41
%49 = load i8*, i8** %5
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i8*, i8** %6
%54 = call i32 @sys_setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %53)
store i32 %54, i32* %4
br label %63
55: ; preds = %48
%56 = load i8*, i8** %5
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = load i8*, i8** %6
%61 = call i32 @sys_setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %60)
store i32 %61, i32* %4
br label %63
62: ; preds = %55
store i32 0, i32* %4
br label %63
63: ; preds = %62, %59, %52, %45, %38, %31, %24, %18
%64 = load i32, i32* %4
ret i32 %64
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"name\00"
@.str.2 = [11 x i8] c"BLOCK_NAME\00"
@.str.3 = [9 x i8] c"instance\00"
@.str.4 = [15 x i8] c"BLOCK_INSTANCE\00"
@.str.5 = [9 x i8] c"interval\00"
@.str.6 = [15 x i8] c"BLOCK_INTERVAL\00"
@.str.7 = [7 x i8] c"button\00"
@.str.8 = [13 x i8] c"BLOCK_BUTTON\00"
@.str.9 = [2 x i8] c"x\00"
@.str.10 = [8 x i8] c"BLOCK_X\00"
@.str.11 = [2 x i8] c"y\00"
@.str.12 = [8 x i8] c"BLOCK_Y\00"
define i32 @block_setenv(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = icmp eq i8* %1, null
%5 = select i1 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1
%6 = tail call i32 @sys_setenv(i8* %0, i8* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %29
8: ; preds = %3
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %26, label %11
11: ; preds = %8
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %11
%15 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %26, label %17
17: ; preds = %14
%18 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %17
%21 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23, %20, %17, %14, %11, %8
%27 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %8 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), %11 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %14 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), %17 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), %20 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), %23 ]
%28 = tail call i32 @sys_setenv(i8* %27, i8* %5)
br label %29
29: ; preds = %26, %23, %3
%30 = phi i32 [ %6, %3 ], [ 0, %23 ], [ %28, %26 ]
ret i32 %30
}