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

/* Variables and functions */
int atom(struct coho_smiles *, int *);
int ringbond(struct coho_smiles *, int);
int atom_ringbond(struct coho_smiles *x, int *anum) {
  int rc;
  if ((rc = atom(x, anum))) {
    if (rc == -1)
      return -1;
  } else {
    return 0;
  }
  while ((rc = ringbond(x, *anum)))
    if (rc == -1)
      return -1;
  return 1;
}


x86 assembly (clang, -O0):
<atom_ringbond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <atom@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     1164 <atom_ringbond+0x44>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    115f <atom_ringbond+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b2 <atom_ringbond+0x92>
jmp    1170 <atom_ringbond+0x50>
movl   $0x0,-0x4(%rbp)
jmp    11b2 <atom_ringbond+0x92>
jmp    1175 <atom_ringbond+0x55>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1040 <ringbond@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     11ab <atom_ringbond+0x8b>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11a6 <atom_ringbond+0x86>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b2 <atom_ringbond+0x92>
jmp    1175 <atom_ringbond+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atom_ringbond>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <atom@plt>
cmp    $0xffffffff,%eax
je     115b <atom_ringbond+0x3b>
test   %eax,%eax
jne    1140 <atom_ringbond+0x20>
xor    %eax,%eax
jmp    115b <atom_ringbond+0x3b>
nopl   0x0(%rax)
mov    (%r14),%esi
mov    %rbx,%rdi
call   1040 <ringbond@plt>
test   %eax,%eax
je     1156 <atom_ringbond+0x36>
cmp    $0xffffffff,%eax
jne    1140 <atom_ringbond+0x20>
jmp    115b <atom_ringbond+0x3b>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.coho_smiles = type { i32 }
define i32 @atom_ringbond(%struct.coho_smiles* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.coho_smiles*
%5 = alloca i32*
%6 = alloca i32
store %struct.coho_smiles* %0, %struct.coho_smiles** %4
store i32* %1, i32** %5
%7 = load %struct.coho_smiles*, %struct.coho_smiles** %4
%8 = load i32*, i32** %5
%9 = call i32 @atom(%struct.coho_smiles* %7, i32* %8)
store i32 %9, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 -1, i32* %3
br label %30
15: ; preds = %11
br label %17
16: ; preds = %2
store i32 0, i32* %3
br label %30
17: ; preds = %15
br label %18
18: ; preds = %28, %17
%19 = load %struct.coho_smiles*, %struct.coho_smiles** %4
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = call i32 @ringbond(%struct.coho_smiles* %19, i32 %21)
store i32 %22, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %18
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 -1, i32* %3
br label %30
28: ; preds = %24
br label %18
29: ; preds = %18
store i32 1, i32* %3
br label %30
30: ; preds = %29, %27, %16, %14
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.coho_smiles = type { i32 }
define i32 @atom_ringbond(%struct.coho_smiles* %0, i32* %1) {
%3 = tail call i32 @atom(%struct.coho_smiles* %0, i32* %1)
switch i32 %3, label %5 [
i32 0, label %4
i32 -1, label %9
]
4: ; preds = %2
br label %9
5: ; preds = %2, %5
%6 = load i32, i32* %1
%7 = tail call i32 @ringbond(%struct.coho_smiles* %0, i32 %6)
switch i32 %7, label %5 [
i32 0, label %9
i32 -1, label %8
]
8: ; preds = %5
br label %9
9: ; preds = %5, %8, %2, %4
%10 = phi i32 [ 0, %4 ], [ %3, %2 ], [ %7, %8 ], [ 1, %5 ]
ret i32 %10
}