#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 */
int /*<<< orphan*/ printf(char *, char const *, int, int);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ write_value(char const *, char *, char const *);
void vary(int css, int num, const char *dir, const char *val) {
  const char *op;
  if (strcmp(val, "0") == 0)
    op = "offline";
  else
    op = "online";
  printf("Vary %s %x.%02x... ", op, css, num);
  write_value(dir, "status", val);
}


x86 assembly (clang, -O0):
<vary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1170 <vary+0x40>
lea    0xe9b(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    117b <vary+0x4b>
lea    0xe93(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe85(%rip),%rsi
call   1050 <write_value@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vary>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %edi,%ebp
lea    0xeb7(%rip),%rsi
mov    %rcx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xea7(%rip),%rax
lea    0xea8(%rip),%rsi
cmove  %rax,%rsi
lea    0xea4(%rip),%rdi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1030 <printf@plt>
lea    0xea7(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <write_value@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [8 x i8] c"offline\00"
@.str.2 = [7 x i8] c"online\00"
@.str.3 = [20 x i8] c"Vary %s %x.%02x... \00"
@.str.4 = [7 x i8] c"status\00"
define void @vary(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %4
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %15
14: ; preds = %4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %15
15: ; preds = %14, %13
%16 = load i8*, i8** %9
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %16, i32 %17, i32 %18)
%20 = load i8*, i8** %7
%21 = load i8*, i8** %8
%22 = call i32 @write_value(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [8 x i8] c"offline\00"
@.str.2 = [7 x i8] c"online\00"
@.str.3 = [20 x i8] c"Vary %s %x.%02x... \00"
@.str.4 = [7 x i8] c"status\00"
define void @vary(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %7, i32 %0, i32 %1)
%9 = tail call i32 @write_value(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %3)
ret void
}