#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 sscanf(char *, char *, int *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int get_block_align_vals(char *s, int *a, int *w) {
  char buf[32];
  int r;
  *w = -1;
  r = sscanf(s, "%d,%31s", w, buf);
  if (!strcmp(buf, "_LEFT"))
    *a = 1;
  else if (!strcmp(buf, "_RIGHT"))
    *a = 2;
  else if (!strcmp(buf, "_CENTER"))
    *a = 0;
  else
    *a = -1;
  return r;
}


x86 assembly (clang, -O0):
<get_block_align_vals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    0xeaf(%rip),%rsi
call   1040 <sscanf@plt>
mov    %eax,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1181 <get_block_align_vals+0x61>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    11e5 <get_block_align_vals+0xc5>
lea    -0x40(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a9 <get_block_align_vals+0x89>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    11e0 <get_block_align_vals+0xc0>
lea    -0x40(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11d1 <get_block_align_vals+0xb1>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11db <get_block_align_vals+0xbb>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    11e0 <get_block_align_vals+0xc0>
jmp    11e5 <get_block_align_vals+0xc5>
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_block_align_vals>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
movl   $0xffffffff,(%rdx)
lea    0xedb(%rip),%rsi
mov    %rsp,%rcx
call   1030 <sscanf@plt>
mov    $0x46454c5f,%ecx
xor    (%rsp),%ecx
movzwl 0x4(%rsp),%edx
xor    $0x54,%edx
or     %ecx,%edx
je     116d <get_block_align_vals+0x5d>
mov    $0x4749525f,%ecx
xor    (%rsp),%ecx
mov    $0x544847,%edx
xor    0x3(%rsp),%edx
or     %ecx,%edx
je     1174 <get_block_align_vals+0x64>
movabs $0x5245544e45435f,%rdx
xor    %ecx,%ecx
cmp    %rdx,(%rsp)
setne  %cl
neg    %ecx
jmp    1179 <get_block_align_vals+0x69>
mov    $0x1,%ecx
jmp    1179 <get_block_align_vals+0x69>
mov    $0x2,%ecx
mov    %ecx,(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d,%31s\00"
@.str.1 = [6 x i8] c"_LEFT\00"
@.str.2 = [7 x i8] c"_RIGHT\00"
@.str.3 = [8 x i8] c"_CENTER\00"
define i32 @get_block_align_vals(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [32 x i8]
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %6
store i32 -1, i32* %9
%10 = load i8*, i8** %4
%11 = load i32*, i32** %6
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%13 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %11, i8* %12)
store i32 %13, i32* %8
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %3
%18 = load i32*, i32** %5
store i32 1, i32* %18
br label %35
19: ; preds = %3
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = load i32*, i32** %5
store i32 2, i32* %24
br label %34
25: ; preds = %19
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = load i32*, i32** %5
store i32 0, i32* %30
br label %33
31: ; preds = %25
%32 = load i32*, i32** %5
store i32 -1, i32* %32
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %23
br label %35
35: ; preds = %34, %17
%36 = load i32, i32* %8
ret i32 %36
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d,%31s\00"
@.str.1 = [6 x i8] c"_LEFT\00"
@.str.2 = [7 x i8] c"_RIGHT\00"
define i32 @get_block_align_vals(i8* nocapture %0, i32* nocapture writeonly %1, i32* %2) {
%4 = alloca [32 x i8]
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
store i32 -1, i32* %2
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2, i8* %5)
%7 = call i32 @bcmp(i8* dereferenceable(6) %5, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %3
%10 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 7)
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = bitcast [32 x i8]* %4 to i64*
%14 = load i64, i64* %13
%15 = icmp ne i64 %14, 23157176483005279
%16 = sext i1 %15 to i32
br label %17
17: ; preds = %12, %9, %3
%18 = phi i32 [ 1, %3 ], [ 2, %9 ], [ %16, %12 ]
store i32 %18, i32* %1
ret i32 %6
}