#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 imap {
  int dummy;
};

/* Variables and functions */
char *hlit(int);
struct imap *nxt(struct imap *, int);
scalar_t__ opeq(struct imap *, char const *, int /*<<< orphan*/,
                int /*<<< orphan*/, int /*<<< orphan*/);
char *ota1(struct imap *);
char *ota2(struct imap *);
int /*<<< orphan*/ printf(char *, char *, ...);
int _chklong(struct imap *ci, const char *op1, const char *op2, int hli) {
  struct imap *ni;
  ni = nxt(ci, 1);
  if (opeq(ci, op1, 0, 0, 0) && opeq(ni, op2, 0, 0, 0)) {
    printf("mklong(%s,", ota1(ni));
    printf("%s) %s= mklong(%s,", ota1(ci), hlit(hli), ota2(ni));
    printf(",%s)\n", ota2(ci));
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_chklong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1070 <nxt@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <opeq@plt>
cmp    $0x0,%rax
je     1244 <_chklong+0xe4>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <opeq@plt>
cmp    $0x0,%rax
je     1244 <_chklong+0xe4>
mov    -0x30(%rbp),%rdi
call   1080 <ota1@plt>
mov    %rax,%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <ota1@plt>
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%edi
call   1060 <hlit@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <ota2@plt>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <ota2@plt>
mov    %rax,%rsi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124b <_chklong+0xeb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_chklong>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r13
mov    $0x1,%esi
call   1070 <nxt@plt>
mov    %rax,%r15
xor    %ebp,%ebp
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <opeq@plt>
test   %rax,%rax
je     1226 <_chklong+0xc6>
xor    %ebp,%ebp
mov    %r15,%rdi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <opeq@plt>
test   %rax,%rax
je     1226 <_chklong+0xc6>
mov    %r15,%rdi
call   1080 <ota1@plt>
lea    0xe3f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
call   1080 <ota1@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1060 <hlit@plt>
mov    %rax,%rbp
mov    %r15,%rdi
call   1050 <ota2@plt>
lea    0xe08(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
call   1050 <ota2@plt>
lea    0xdfc(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.imap = type { i32 }
@.str = [11 x i8] c"mklong(%s,\00"
@.str.1 = [19 x i8] c"%s) %s= mklong(%s,\00"
@.str.2 = [6 x i8] c",%s)\0A\00"
define i32 @_chklong(%struct.imap* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.imap*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.imap*
store %struct.imap* %0, %struct.imap** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load %struct.imap*, %struct.imap** %6
%12 = call %struct.imap* @nxt(%struct.imap* %11, i32 1)
store %struct.imap* %12, %struct.imap** %10
%13 = load %struct.imap*, %struct.imap** %6
%14 = load i8*, i8** %7
%15 = call i64 @opeq(%struct.imap* %13, i8* %14, i32 0, i32 0, i32 0)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %36
17: ; preds = %4
%18 = load %struct.imap*, %struct.imap** %10
%19 = load i8*, i8** %8
%20 = call i64 @opeq(%struct.imap* %18, i8* %19, i32 0, i32 0, i32 0)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %36
22: ; preds = %17
%23 = load %struct.imap*, %struct.imap** %10
%24 = call i8* @ota1(%struct.imap* %23)
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = load %struct.imap*, %struct.imap** %6
%27 = call i8* @ota1(%struct.imap* %26)
%28 = load i32, i32* %9
%29 = call i8* @hlit(i32 %28)
%30 = load %struct.imap*, %struct.imap** %10
%31 = call i8* @ota2(%struct.imap* %30)
%32 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %29, i8* %31)
%33 = load %struct.imap*, %struct.imap** %6
%34 = call i8* @ota2(%struct.imap* %33)
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %34)
store i32 1, i32* %5
br label %37
36: ; preds = %17, %4
store i32 0, i32* %5
br label %37
37: ; preds = %36, %22
%38 = load i32, i32* %5
ret i32 %38
}

LLVM IR (-O2):
%struct.imap = type { i32 }
@.str = [11 x i8] c"mklong(%s,\00"
@.str.1 = [19 x i8] c"%s) %s= mklong(%s,\00"
@.str.2 = [6 x i8] c",%s)\0A\00"
define i32 @_chklong(%struct.imap* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call %struct.imap* @nxt(%struct.imap* %0, i32 1)
%6 = tail call i64 @opeq(%struct.imap* %0, i8* %1, i32 0, i32 0, i32 0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %4
%9 = tail call i64 @opeq(%struct.imap* %5, i8* %2, i32 0, i32 0, i32 0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %8
%12 = tail call i8* @ota1(%struct.imap* %5)
%13 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i8* @ota1(%struct.imap* %0)
%15 = tail call i8* @hlit(i32 %3)
%16 = tail call i8* @ota2(%struct.imap* %5)
%17 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %15, i8* %16)
%18 = tail call i8* @ota2(%struct.imap* %0)
%19 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %4, %8, %11
%21 = phi i32 [ 1, %11 ], [ 0, %8 ], [ 0, %4 ]
ret i32 %21
}