#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 termios {
  scalar_t__ c_iflag;
  scalar_t__ c_oflag;
  scalar_t__ c_cflag;
  scalar_t__ c_lflag;
  scalar_t__ c_ispeed;
  scalar_t__ c_ospeed;
  int /*<<< orphan*/ c_cc;
};

/* Variables and functions */
int memcmp(int /*<<< orphan*/, int /*<<< orphan*/, int);
int termcmp(struct termios *a, struct termios *b) {
  if (a->c_iflag != b->c_iflag || a->c_oflag != b->c_oflag ||
      a->c_cflag != b->c_cflag || a->c_lflag != b->c_lflag ||
      a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed)
    return 1;
  return memcmp(a->c_cc, b->c_cc, sizeof(a->c_cc));
}


x86 assembly (clang, -O0):
<termcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jne    11a2 <termcmp+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
jne    11a2 <termcmp+0x92>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x10(%rcx),%rax
jne    11a2 <termcmp+0x92>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x18(%rcx),%rax
jne    11a2 <termcmp+0x92>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x20(%rcx),%rax
jne    11a2 <termcmp+0x92>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x28(%rcx),%rax
je     11ae <termcmp+0x9e>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <termcmp+0xb9>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%esi
mov    $0x4,%edx
call   1030 <memcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termcmp>:
mov    (%rdi),%rax
cmp    (%rsi),%rax
jne    115a <termcmp+0x4a>
mov    0x8(%rdi),%rax
cmp    0x8(%rsi),%rax
jne    115a <termcmp+0x4a>
mov    0x10(%rdi),%rax
cmp    0x10(%rsi),%rax
jne    115a <termcmp+0x4a>
mov    0x18(%rdi),%rax
cmp    0x18(%rsi),%rax
jne    115a <termcmp+0x4a>
mov    0x20(%rdi),%rax
cmp    0x20(%rsi),%rax
jne    115a <termcmp+0x4a>
mov    0x28(%rdi),%rax
cmp    0x28(%rsi),%rax
jne    115a <termcmp+0x4a>
mov    0x30(%rdi),%edi
mov    0x30(%rsi),%esi
mov    $0x4,%edx
jmp    1030 <memcmp@plt>
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.termios = type { i64, i64, i64, i64, i64, i64, i32 }
define i32 @termcmp(%struct.termios* %0, %struct.termios* %1) {
%3 = alloca i32
%4 = alloca %struct.termios*
%5 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %4
store %struct.termios* %1, %struct.termios** %5
%6 = load %struct.termios*, %struct.termios** %4
%7 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load %struct.termios*, %struct.termios** %5
%10 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp ne i64 %8, %11
br i1 %12, label %53, label %13
13: ; preds = %2
%14 = load %struct.termios*, %struct.termios** %4
%15 = getelementptr inbounds %struct.termios, %struct.termios* %14, i32 0, i32 1
%16 = load i64, i64* %15
%17 = load %struct.termios*, %struct.termios** %5
%18 = getelementptr inbounds %struct.termios, %struct.termios* %17, i32 0, i32 1
%19 = load i64, i64* %18
%20 = icmp ne i64 %16, %19
br i1 %20, label %53, label %21
21: ; preds = %13
%22 = load %struct.termios*, %struct.termios** %4
%23 = getelementptr inbounds %struct.termios, %struct.termios* %22, i32 0, i32 2
%24 = load i64, i64* %23
%25 = load %struct.termios*, %struct.termios** %5
%26 = getelementptr inbounds %struct.termios, %struct.termios* %25, i32 0, i32 2
%27 = load i64, i64* %26
%28 = icmp ne i64 %24, %27
br i1 %28, label %53, label %29
29: ; preds = %21
%30 = load %struct.termios*, %struct.termios** %4
%31 = getelementptr inbounds %struct.termios, %struct.termios* %30, i32 0, i32 3
%32 = load i64, i64* %31
%33 = load %struct.termios*, %struct.termios** %5
%34 = getelementptr inbounds %struct.termios, %struct.termios* %33, i32 0, i32 3
%35 = load i64, i64* %34
%36 = icmp ne i64 %32, %35
br i1 %36, label %53, label %37
37: ; preds = %29
%38 = load %struct.termios*, %struct.termios** %4
%39 = getelementptr inbounds %struct.termios, %struct.termios* %38, i32 0, i32 4
%40 = load i64, i64* %39
%41 = load %struct.termios*, %struct.termios** %5
%42 = getelementptr inbounds %struct.termios, %struct.termios* %41, i32 0, i32 4
%43 = load i64, i64* %42
%44 = icmp ne i64 %40, %43
br i1 %44, label %53, label %45
45: ; preds = %37
%46 = load %struct.termios*, %struct.termios** %4
%47 = getelementptr inbounds %struct.termios, %struct.termios* %46, i32 0, i32 5
%48 = load i64, i64* %47
%49 = load %struct.termios*, %struct.termios** %5
%50 = getelementptr inbounds %struct.termios, %struct.termios* %49, i32 0, i32 5
%51 = load i64, i64* %50
%52 = icmp ne i64 %48, %51
br i1 %52, label %53, label %54
53: ; preds = %45, %37, %29, %21, %13, %2
store i32 1, i32* %3
br label %62
54: ; preds = %45
%55 = load %struct.termios*, %struct.termios** %4
%56 = getelementptr inbounds %struct.termios, %struct.termios* %55, i32 0, i32 6
%57 = load i32, i32* %56
%58 = load %struct.termios*, %struct.termios** %5
%59 = getelementptr inbounds %struct.termios, %struct.termios* %58, i32 0, i32 6
%60 = load i32, i32* %59
%61 = call i32 @memcmp(i32 %57, i32 %60, i32 4)
store i32 %61, i32* %3
br label %62
62: ; preds = %54, %53
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
%struct.termios = type { i64, i64, i64, i64, i64, i64, i32 }
define i32 @termcmp(%struct.termios* nocapture %0, %struct.termios* nocapture %1) {
%3 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp eq i64 %4, %6
br i1 %7, label %8, label %44
8: ; preds = %2
%9 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
%10 = load i64, i64* %9
%11 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%12 = load i64, i64* %11
%13 = icmp eq i64 %10, %12
br i1 %13, label %14, label %44
14: ; preds = %8
%15 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 2
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 2
%18 = load i64, i64* %17
%19 = icmp eq i64 %16, %18
br i1 %19, label %20, label %44
20: ; preds = %14
%21 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 3
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 3
%24 = load i64, i64* %23
%25 = icmp eq i64 %22, %24
br i1 %25, label %26, label %44
26: ; preds = %20
%27 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 4
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 4
%30 = load i64, i64* %29
%31 = icmp eq i64 %28, %30
br i1 %31, label %32, label %44
32: ; preds = %26
%33 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 5
%34 = load i64, i64* %33
%35 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 5
%36 = load i64, i64* %35
%37 = icmp eq i64 %34, %36
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 6
%40 = load i32, i32* %39
%41 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 6
%42 = load i32, i32* %41
%43 = tail call i32 @memcmp(i32 %40, i32 %42, i32 4)
br label %44
44: ; preds = %2, %8, %14, %20, %26, %32, %38
%45 = phi i32 [ %43, %38 ], [ 1, %32 ], [ 1, %26 ], [ 1, %20 ], [ 1, %14 ], [ 1, %8 ], [ 1, %2 ]
ret i32 %45
}