title: Brainstorming: why comparing a memory address with a small integer
body: <p>Background:  I'm reversing an Obj-C  instance method belonging to a certain class. Here is the interface of the class</p>
  
  <pre><code>@interface myClass : NSObject
      { 
              // aStructure contains a lot of function pointers
  
           struct aStructure **_myStruct;     // ivar offset: 0x14  
           int                             _integer;             // ivar offset: 0x20
      }
  
     - (void)aMethod;
  
  @end
  </code></pre>
  
  <p>Problem: </p>
  
  <p>Here is a snippet of <code>aMethod</code> disassembly</p>
  
  <pre><code>[0x0]      mov   edi,    [ebp+arg_0]     ## put self into edi
  [0x2]      mov   edx,   [edi+20h]        ## put  self._integer into edi
  [0x3]      cmp   edx,   1
  [0x4]      jl       end_of_method       ## if (self._integer &lt; 1) return;
  [0x5]      lea     eax,   [edx-0Ch]       ## put &amp;self._myStruct into eax
  [0x6]      cmp   eax,   3
  [0x7]      ja      end_of_method       ## if (&amp;self._myStruct &gt; 3) return;
  // other stuff
  </code></pre>
  
  <p>The 6th line shows a comparaison between a memory address (<code>&amp;self._myStruct</code>) with <code>3</code>.</p>
  
  <p>Question: why would you compare a memory address with an int ? It doesn't make much sense for me, since a memory address will be always > 3, and thus the method will always exit in this case.  </p>