#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 */
struct scale {
  int dummy;
};

/* Variables and functions */
int scale_get_orient_bit(struct scale *);
int /*<<< orphan*/ scale_set_orient_bit(struct scale *, int);
int /*<<< orphan*/ strcmp(char *, char *);
void scale_set_orient(struct scale *s, char *orient) {
  if (!strcmp("vertical", orient)) {
    scale_set_orient_bit(s, scale_get_orient_bit(s) | 0x1);
    return;
  }
  if (!strcmp("horizontal", orient)) {
    scale_set_orient_bit(s, scale_get_orient_bit(s) & (-1 ^ 0x1));
    return;
  }
}


x86 assembly (clang, -O0):
<scale_set_orient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    117d <scale_set_orient+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <scale_get_orient_bit@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
or     $0x1,%esi
call   1050 <scale_set_orient_bit@plt>
jmp    11b5 <scale_set_orient+0x85>
mov    -0x10(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b5 <scale_set_orient+0x85>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <scale_get_orient_bit@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
and    $0xfffffffe,%esi
call   1050 <scale_set_orient_bit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_set_orient>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xebf(%rip),%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1165 <scale_set_orient+0x35>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1172 <scale_set_orient+0x42>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
call   1030 <scale_get_orient_bit@plt>
or     $0x1,%eax
jmp    117d <scale_set_orient+0x4d>
mov    %r14,%rdi
call   1030 <scale_get_orient_bit@plt>
and    $0xfffffffe,%eax
mov    %r14,%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <scale_set_orient_bit@plt>

LLVM IR (-O0):
%struct.scale = type { i32 }
@.str = [9 x i8] c"vertical\00"
@.str.1 = [11 x i8] c"horizontal\00"
define void @scale_set_orient(%struct.scale* %0, i8* %1) {
%3 = alloca %struct.scale*
%4 = alloca i8*
store %struct.scale* %0, %struct.scale** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @strcmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load %struct.scale*, %struct.scale** %3
%10 = load %struct.scale*, %struct.scale** %3
%11 = call i32 @scale_get_orient_bit(%struct.scale* %10)
%12 = or i32 %11, 1
%13 = call i32 @scale_set_orient_bit(%struct.scale* %9, i32 %12)
br label %24
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = call i32 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %14
%19 = load %struct.scale*, %struct.scale** %3
%20 = load %struct.scale*, %struct.scale** %3
%21 = call i32 @scale_get_orient_bit(%struct.scale* %20)
%22 = and i32 %21, -2
%23 = call i32 @scale_set_orient_bit(%struct.scale* %19, i32 %22)
br label %24
24: ; preds = %8, %18, %14
ret void
}

LLVM IR (-O2):
%struct.scale = type { i32 }
@.str = [9 x i8] c"vertical\00"
@.str.1 = [11 x i8] c"horizontal\00"
define void @scale_set_orient(%struct.scale* %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @scale_get_orient_bit(%struct.scale* %0)
%7 = or i32 %6, 1
br label %14
8: ; preds = %2
%9 = tail call i32 @strcmp(i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* dereferenceable(1) %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = tail call i32 @scale_get_orient_bit(%struct.scale* %0)
%13 = and i32 %12, -2
br label %14
14: ; preds = %11, %5
%15 = phi i32 [ %7, %5 ], [ %13, %11 ]
%16 = tail call i32 @scale_set_orient_bit(%struct.scale* %0, i32 %15)
br label %17
17: ; preds = %14, %8
ret void
}