#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__ EOF;
int /*<<< orphan*/ perror(char *);
scalar_t__ sscanf(char const *, char *, int *, int *, int *, int *);
int aqwin_parsegeom(const char *g, int *w, int *h, int *x, int *y) {
  if (sscanf(g, "%dx%d@%d,%d", w, h, x, y) == EOF) {
    perror("aqwin_open");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<aqwin_parsegeom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    0xea9(%rip),%rsi
call   1030 <sscanf@plt>
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%rax
jne    1184 <aqwin_parsegeom+0x64>
lea    0xe99(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <aqwin_parsegeom+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aqwin_parsegeom>:
push   %rax
mov    %r8,%r9
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xecc(%rip),%rsi
call   1030 <sscanf@plt>
mov    %rax,%rcx
mov    0x2ea5(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
je     114c <aqwin_parsegeom+0x2c>
pop    %rcx
ret
lea    0xeb9(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%dx%d@%d,%d\00"
@EOF = global i64 0
@.str.1 = [11 x i8] c"aqwin_open\00"
define i32 @aqwin_parsegeom(i8* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i8* %0, i8** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%12 = load i8*, i8** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load i32*, i32** %10
%16 = load i32*, i32** %11
%17 = call i64 @sscanf(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %13, i32* %14, i32* %15, i32* %16)
%18 = load i64, i64* @EOF
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %5
%21 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %6
br label %23
22: ; preds = %5
store i32 0, i32* %6
br label %23
23: ; preds = %22, %20
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [12 x i8] c"%dx%d@%d,%d\00"
@EOF = global i64 0
@.str.1 = [11 x i8] c"aqwin_open\00"
define i32 @aqwin_parsegeom(i8* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = tail call i64 @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %5, %9
%12 = phi i32 [ -1, %9 ], [ 0, %5 ]
ret i32 %12
}