xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strstr(char *, char *);
int CheckTerminator(char *message) {
  char *term;
  term = strstr(message, "^>");
  if (term == message)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<CheckTerminator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    114a <CheckTerminator+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <CheckTerminator+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckTerminator>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"^>\00"
define i32 @CheckTerminator(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strstr(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = icmp eq i8* %7, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"^>\00"
define i32 @CheckTerminator(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long icon_mask;
};
typedef TYPE_1__ XWMHints;

/* Variables and functions */
void set_XWMHints_icon_mask(void *_p, unsigned long _v) {
  ((XWMHints *)_p)->icon_mask = (unsigned long)_v;
}


x86 assembly (clang, -O0):
<set_XWMHints_icon_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XWMHints_icon_mask>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XWMHints_icon_mask(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XWMHints_icon_mask(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
void bit_encode(int *output, const int right, const int left) {
  (*output) = (left << 15) | right;
}


x86 assembly (clang, -O0):
<bit_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
shl    $0xf,%ecx
or     -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_encode>:
shl    $0xf,%edx
or     %esi,%edx
mov    %edx,(%rdi)
ret

LLVM IR (-O0):
define void @bit_encode(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = shl i32 %7, 15
%9 = load i32, i32* %5
%10 = or i32 %8, %9
%11 = load i32*, i32** %4
store i32 %10, i32* %11
ret void
}

LLVM IR (-O2):
define void @bit_encode(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 15
%5 = or i32 %4, %1
store i32 %5, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char *get_line_from_file();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
char *get_line_with_prompt() {
  printf("> ");
  fflush(stdout);
  return get_line_from_file();
}


x86 assembly (clang, -O0):
<get_line_with_prompt>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x0,%al
call   1050 <get_line_from_file@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_line_with_prompt>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <get_line_from_file@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
@stdout = global i32 0
define i8* @get_line_with_prompt() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
%4 = call i8* (...) @get_line_from_file()
ret i8* %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
@stdout = global i32 0
define i8* @get_line_with_prompt() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i8* (...) @get_line_from_file()
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ XKeyEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XKeyEvent(void *_p) {
  if (_p == NULL)
    abort();
  free((XKeyEvent *)_p);
}


x86 assembly (clang, -O0):
<free_XKeyEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XKeyEvent+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XKeyEvent>:
test   %rdi,%rdi
je     112a <free_XKeyEvent+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XKeyEvent(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XKeyEvent(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int SendCGI(int client_sock, char *filename, char *pathinfo) {
  system(filename);
}


x86 assembly (clang, -O0):
<SendCGI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendCGI>:
mov    %rsi,%rdi
jmp    1030 <system@plt>

LLVM IR (-O0):
define i32 @SendCGI(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %6
%9 = call i32 @system(i8* %8)
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
define i32 @SendCGI(i32 %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = tail call i32 @system(i8* %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ errnoAbort(char *);
int netConnect(char *, int /*<<< orphan*/);
int gfConnect(char *hostName, char *portName) {
  int sd = netConnect(hostName, atoi(portName));
  if (sd < 0) {
    errnoAbort("Sorry, the BLAT/iPCR server seems to be down.  Please try "
               "again later.");
  }
  return sd;
}


x86 assembly (clang, -O0):
<gfConnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <netConnect@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1175 <gfConnect+0x45>
lea    0xe90(%rip),%rdi
call   1030 <errnoAbort@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfConnect>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <netConnect@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1158 <gfConnect+0x28>
lea    0xead(%rip),%rdi
call   1030 <errnoAbort@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [71 x i8] c"Sorry, the BLAT/iPCR server seems to be down. Please try again later.\00"
define i32 @gfConnect(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @atoi(i8* %7)
%9 = call i32 @netConnect(i8* %6, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @errnoAbort(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@.str = [71 x i8] c"Sorry, the BLAT/iPCR server seems to be down. Please try again later.\00"
define i32 @gfConnect(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @atoi(i8* %1)
%4 = tail call i32 @netConnect(i8* %0, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @errnoAbort(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int ewf_compress(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int ewf_sectors_chunk_compress(uint8_t *compressed_sectors_chunk,
                               uint32_t *compressed_size,
                               uint8_t *sectors_chunk, uint32_t size,
                               int8_t compression_level) {
  return (ewf_compress(compressed_sectors_chunk, compressed_size, sectors_chunk,
                       size, compression_level));
}


x86 assembly (clang, -O0):
<ewf_sectors_chunk_compress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <ewf_compress@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ewf_sectors_chunk_compress>:
jmp    1030 <ewf_compress@plt>

LLVM IR (-O0):
define i32 @ewf_sectors_chunk_compress(i32* %0, i32* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @ewf_compress(i32* %11, i32* %12, i32* %13, i32 %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @ewf_sectors_chunk_compress(i32* %0, i32* %1, i32* %2, i32 %3, i32 %4) {
%6 = tail call i32 @ewf_compress(i32* %0, i32* %1, i32* %2, i32 %3, i32 %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ PIN_IRQ_Handler(int);
void PIN_INT1_IRQHandler(void) { PIN_IRQ_Handler(1); }


x86 assembly (clang, -O0):
<PIN_INT1_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <PIN_IRQ_Handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PIN_INT1_IRQHandler>:
mov    $0x1,%edi
jmp    1030 <PIN_IRQ_Handler@plt>

LLVM IR (-O0):
define void @PIN_INT1_IRQHandler() {
%1 = call i32 @PIN_IRQ_Handler(i32 1)
ret void
}

LLVM IR (-O2):
define void @PIN_INT1_IRQHandler() {
%1 = tail call i32 @PIN_IRQ_Handler(i32 1)
ret void
}
int Vec_IntSortCompareUnsigned(unsigned *pp1, unsigned *pp2) {
  if (*pp1 < *pp2)
    return -1;
  if (*pp1 > *pp2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<Vec_IntSortCompareUnsigned>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jae    112a <Vec_IntSortCompareUnsigned+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    114f <Vec_IntSortCompareUnsigned+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jbe    1148 <Vec_IntSortCompareUnsigned+0x48>
movl   $0x1,-0x4(%rbp)
jmp    114f <Vec_IntSortCompareUnsigned+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vec_IntSortCompareUnsigned>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @Vec_IntSortCompareUnsigned(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = icmp ult i32 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %20
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = icmp ugt i32 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 1, i32* %3
br label %20
19: ; preds = %12
store i32 0, i32* %3
br label %20
20: ; preds = %19, %18, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @Vec_IntSortCompareUnsigned(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp ult i32 %3, %4
%6 = icmp ugt i32 %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void kill(char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<kill>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @kill(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @kill(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
short findChar(char *alphabet, char ch) {
  for (short i = 0; 0 != alphabet[i]; i++) {
    if (alphabet[i] == ch) {
      return (i);
    }
  }
  return (-1);
}


x86 assembly (clang, -O0):
<findChar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movw   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movswq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1167 <findChar+0x67>
mov    -0x10(%rbp),%rax
movswq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1151 <findChar+0x51>
mov    -0x14(%rbp),%ax
mov    %ax,-0x2(%rbp)
jmp    116d <findChar+0x6d>
jmp    1156 <findChar+0x56>
mov    -0x14(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x14(%rbp)
jmp    1114 <findChar+0x14>
movw   $0xffff,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findChar>:
mov    (%rdi),%dl
mov    $0xffff,%ax
test   %dl,%dl
je     1124 <findChar+0x24>
xor    %ecx,%ecx
nopl   0x0(%rax)
cmp    %sil,%dl
je     1125 <findChar+0x25>
add    $0x1,%ecx
movswq %cx,%rdx
movzbl (%rdi,%rdx,1),%edx
test   %dl,%dl
jne    1110 <findChar+0x10>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @findChar(i8* %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i16
store i8* %0, i8** %4
store i8 %1, i8* %5
store i16 0, i16* %6
br label %7
7: ; preds = %28, %2
%8 = load i8*, i8** %4
%9 = load i16, i16* %6
%10 = sext i16 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 0, %13
br i1 %14, label %15, label %31
15: ; preds = %7
%16 = load i8*, i8** %4
%17 = load i16, i16* %6
%18 = sext i16 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %27
25: ; preds = %15
%26 = load i16, i16* %6
store i16 %26, i16* %3
br label %32
27: ; preds = %15
br label %28
28: ; preds = %27
%29 = load i16, i16* %6
%30 = add i16 %29, 1
store i16 %30, i16* %6
br label %7
31: ; preds = %7
store i16 -1, i16* %3
br label %32
32: ; preds = %31, %25
%33 = load i16, i16* %3
ret i16 %33
}

LLVM IR (-O2):
define signext i16 @findChar(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %9
%6 = phi i8 [ %13, %9 ], [ %3, %2 ]
%7 = phi i16 [ %10, %9 ], [ 0, %2 ]
%8 = icmp eq i8 %6, %1
br i1 %8, label %15, label %9
9: ; preds = %5
%10 = add i16 %7, 1
%11 = sext i16 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %9, %5, %2
%16 = phi i16 [ -1, %2 ], [ %7, %5 ], [ -1, %9 ]
ret i16 %16
}
void swap(int *a, int *b) {
  int m;
  m = *a;
  *a = *b;
  *b = m;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
void strreplc(char *s) {
  for (; *s != '\0'; s++)
    if (*s == ',')
      *s = ' ';
}


x86 assembly (clang, -O0):
<strreplc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1145 <strreplc+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    112f <strreplc+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x20,(%rax)
jmp    1134 <strreplc+0x34>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <strreplc+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strreplc>:
jmp    1117 <strreplc+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x20,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2c,%al
je     1110 <strreplc+0x10>
test   %al,%al
jne    1113 <strreplc+0x13>
ret

LLVM IR (-O0):
define void @strreplc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %16, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 44
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = load i8*, i8** %2
store i8 32, i8* %14
br label %15
15: ; preds = %13, %8
br label %16
16: ; preds = %15
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %3
19: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @strreplc(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 44, label %5
]
5: ; preds = %2
store i8 32, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ArgItem();
int Cnd_CanMoveRope(void) {
  ArgItem();
  return (1);
}


x86 assembly (clang, -O0):
<Cnd_CanMoveRope>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ArgItem@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cnd_CanMoveRope>:
push   %rax
xor    %eax,%eax
call   1030 <ArgItem@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @Cnd_CanMoveRope() {
%1 = call i32 (...) @ArgItem()
ret i32 1
}

LLVM IR (-O2):
define i32 @Cnd_CanMoveRope() {
%1 = tail call i32 (...) @ArgItem()
ret i32 1
}
char *_strcpy(char *dest, char *src) {
  int i;
  i = 0;
  while (*(src + i)) {
    *(dest + i) = *(src + i);
    i++;
  }
  i++;
  *(dest + i) = 0;
  return (dest);
}


x86 assembly (clang, -O0):
<_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1149 <_strcpy+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <_strcpy+0x13>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1127 <_strcpy+0x27>
mov    $0x1,%edx
xchg   %ax,%ax
mov    %cl,-0x1(%rax,%rdx,1)
movzbl (%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <_strcpy+0x10>
mov    %edx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret
mov    $0x1,%ecx
movb   $0x0,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define i8* @_strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %6
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
%28 = load i8*, i8** %3
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 0, i8* %31
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @_strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = add nuw i64 %6, 2
%15 = and i64 %14, 4294967295
br label %16
16: ; preds = %13, %2
%17 = phi i64 [ 1, %2 ], [ %15, %13 ]
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 0, i8* %18
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  int i;
  printf("@@XX@@ Inferior Starting @@XX@@\n");
  for (i = 0; i < 120; ++i)
    sleep(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x78,-0x8(%rbp)
jge    1164 <main+0x44>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x78,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
call   1040 <sleep@plt>
add    $0xffffffff,%ebx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"@@XX@@ Inferior Starting @@XX@@\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 120
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = call i32 @sleep(i32 1)
br label %9
9: ; preds = %7
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %4
12: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@str = [32 x i8] c"@@XX@@ Inferior Starting @@XX@@\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @sleep(i32 1)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 120
br i1 %6, label %7, label %2
7: ; preds = %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cmd_prompt(int, char **);
int /*<<< orphan*/ run();
int /*<<< orphan*/ setupSignalHandler();
int main() {
  char *prompt_argv[2] = {"prompt", "% "};
  cmd_prompt(2, prompt_argv);
  setupSignalHandler();
  run();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x2,%edi
call   1050 <cmd_prompt@plt>
mov    $0x0,%al
call   1040 <setupSignalHandler@plt>
mov    $0x0,%al
call   1030 <run@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0x2cd5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
call   1050 <cmd_prompt@plt>
xor    %eax,%eax
call   1040 <setupSignalHandler@plt>
xor    %eax,%eax
call   1030 <run@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"prompt\00"
@.str.1 = [3 x i8] c"% \00"
@__const.main.prompt_argv = [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8*]
store i32 0, i32* %1
%3 = bitcast [2 x i8*]* %2 to i8*
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%5 = call i32 @cmd_prompt(i32 2, i8** %4)
%6 = call i32 (...) @setupSignalHandler()
%7 = call i32 (...) @run()
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"prompt\00"
@.str.1 = [3 x i8] c"% \00"
@__const.main.prompt_argv = [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)]
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i32 @cmd_prompt(i32 2, i8** %3)
%5 = call i32 (...) @setupSignalHandler()
%6 = call i32 (...) @run()
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int call_cpp_class_add(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("2 + 4 = %d\n", call_cpp_class_add(2, 4));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <call_cpp_class_add@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <call_cpp_class_add@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"2 + 4 = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @call_cpp_class_add(i32 2, i32 4)
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}

LLVM IR (-O2):
@.str = [12 x i8] c"2 + 4 = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @call_cpp_class_add(i32 2, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_slli_epi32(int /*<<< orphan*/, int);
__m128i __attribute__((no, unused)) testneg128(__m128i s1) {
  return _mm_slli_epi32(s1, -128);
}


x86 assembly (clang, -O0):
<testneg128>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xffffff80,%esi
call   1030 <_mm_slli_epi32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testneg128>:
mov    $0xffffff80,%esi
jmp    1030 <_mm_slli_epi32@plt>

LLVM IR (-O0):
define i32 @testneg128(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_mm_slli_epi32(i32 %3, i32 -128)
ret i32 %4
}

LLVM IR (-O2):
define i32 @testneg128(i32 %0) {
%2 = tail call i32 @_mm_slli_epi32(i32 %0, i32 -128)
ret i32 %2
}
int shmw_cir(const struct shm_s *s __attribute__((__unused__))) { return -1; }


x86 assembly (clang, -O0):
<shmw_cir>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shmw_cir>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.shm_s = type opaque
define i32 @shmw_cir(%struct.shm_s* %0) {
%2 = alloca %struct.shm_s*
store %struct.shm_s* %0, %struct.shm_s** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.shm_s = type opaque
define i32 @shmw_cir(%struct.shm_s* nocapture readnone %0) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ my_strcpy(char *, char *);
int my_strlen(char *);
char *my_strdup(char *str) {
  char *cp;
  cp = malloc(my_strlen(str) * sizeof(str));
  my_strcpy(cp, str);
  return (cp);
}


x86 assembly (clang, -O0):
<my_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_strlen@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <my_strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <my_strlen@plt>
lea    0x0(,%rax,8),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <my_strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @my_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @my_strlen(i8* %4)
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 8
%8 = trunc i64 %7 to i32
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = call i32 @my_strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @my_strdup(i8* %0) {
%2 = tail call i32 @my_strlen(i8* %0)
%3 = shl i32 %2, 3
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @my_strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stdout;
void die(const char *e) {
  fprintf(stdout, "catwm-0.0.5: %s\n", e);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"catwm-0.0.5: %s\0A\00"
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"catwm-0.0.5: %s\0A\00"
define void @die(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void g_queue_index() {}


x86 assembly (clang, -O0):
<g_queue_index>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_queue_index>:
ret

LLVM IR (-O0):
define void @g_queue_index() {
ret void
}

LLVM IR (-O2):
define void @g_queue_index() {
ret void
}
/* Variables and functions */
char getchar();
char get_first(void) {
  int ch;
  ch = getchar();
  while (getchar() != '\n') {
    continue;
  }
  return ch;
}


x86 assembly (clang, -O0):
<get_first>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     113d <get_first+0x2d>
jmp    1125 <get_first+0x15>
mov    -0x4(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_first>:
push   %rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <get_first+0x10>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @get_first() {
%1 = alloca i32
%2 = call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
store i32 %3, i32* %1
br label %4
4: ; preds = %8, %0
%5 = call signext i8 (...) @getchar()
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = load i32, i32* %1
%11 = trunc i32 %10 to i8
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @get_first() {
%1 = tail call signext i8 (...) @getchar()
br label %2
2: ; preds = %2, %0
%3 = tail call signext i8 (...) @getchar()
%4 = icmp eq i8 %3, 10
br i1 %4, label %5, label %2
5: ; preds = %2
ret i8 %1
}
int show1(void (*pfunc)(char *), char *msg) {
  (*pfunc)(msg);
  return 1;
}


x86 assembly (clang, -O0):
<show1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show1>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
call   *%rax
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @show1(void (i8*)* %0, i8* %1) {
%3 = alloca void (i8*)*
%4 = alloca i8*
store void (i8*)* %0, void (i8*)** %3
store i8* %1, i8** %4
%5 = load void (i8*)*, void (i8*)** %3
%6 = load i8*, i8** %4
ret i32 1
}

LLVM IR (-O2):
define i32 @show1(void (i8*)* nocapture %0, i8* %1) {
tail call void %0(i8* %1)
ret i32 1
}
void foo() {
  signed int x = 5;
  signed int y = 2;
  signed int z = x % y;
  signed int w = x % 3;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x5,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
ret

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 5, i32* %1
store i32 2, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = srem i32 %5, %6
store i32 %7, i32* %3
%8 = load i32, i32* %1
%9 = srem i32 %8, 3
store i32 %9, i32* %4
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
void pthread_attr_getguardsize() {}


x86 assembly (clang, -O0):
<pthread_attr_getguardsize>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_attr_getguardsize>:
ret

LLVM IR (-O0):
define void @pthread_attr_getguardsize() {
ret void
}

LLVM IR (-O2):
define void @pthread_attr_getguardsize() {
ret void
}
/* Variables and functions */
double __infer_nondet_double();
double atof(const char *str) { return __infer_nondet_double(); }


x86 assembly (clang, -O0):
<atof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_double@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atof>:
xor    %eax,%eax
jmp    1030 <__infer_nondet_double@plt>

LLVM IR (-O0):
define double @atof(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call double (...) @__infer_nondet_double()
ret double %3
}

LLVM IR (-O2):
define double @atof(i8* nocapture readnone %0) {
%2 = tail call double (...) @__infer_nondet_double()
ret double %2
}
/* Variables and functions */
int U_PMR_NODATAREC_print(char const *);
int U_PMR_GETDC_print(const char *contents) {
  return (U_PMR_NODATAREC_print(contents));
}


x86 assembly (clang, -O0):
<U_PMR_GETDC_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <U_PMR_NODATAREC_print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_PMR_GETDC_print>:
jmp    1030 <U_PMR_NODATAREC_print@plt>

LLVM IR (-O0):
define i32 @U_PMR_GETDC_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @U_PMR_NODATAREC_print(i8* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @U_PMR_GETDC_print(i8* %0) {
%2 = tail call i32 @U_PMR_NODATAREC_print(i8* %0)
ret i32 %2
}
int __knomial_fanin_check(void *context) { return 0; }


x86 assembly (clang, -O0):
<__knomial_fanin_check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__knomial_fanin_check>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @__knomial_fanin_check(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @__knomial_fanin_check(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ version();
usage() {
  version();
  printf("Usage: ping <host>    -- Ping specified host\n");
  printf("       ping -h        -- Display this help\n");
  printf("       ping -v        -- Display version\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <version@plt>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
xor    %eax,%eax
call   1040 <version@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Usage: ping <host> -- Ping specified host\0A\00"
@.str.1 = [44 x i8] c" ping -h -- Display this help\0A\00"
@.str.2 = [42 x i8] c" ping -v -- Display version\0A\00"
define i32 @usage() {
%1 = alloca i32
%2 = call i32 (...) @version()
%3 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@str = [45 x i8] c"Usage: ping <host> -- Ping specified host\00"
@str.3 = [43 x i8] c" ping -h -- Display this help\00"
@str.4 = [41 x i8] c" ping -v -- Display version\00"
define i32 @usage() {
%1 = tail call i32 (...) @version()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.4, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *, ...);
void write_into_file(FILE *outfile, const char *opt, const char *arg,
                     const char *values[]) {
  (void)(values);
  if (arg) {
    fprintf(outfile, "%s=\"%s\"\n", opt, arg);
  } else {
    fprintf(outfile, "%s\n", opt);
  }
}


x86 assembly (clang, -O0):
<write_into_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1152 <write_into_file+0x42>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1168 <write_into_file+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_into_file>:
mov    %rdx,%rcx
mov    %rsi,%rdx
test   %rcx,%rcx
je     1129 <write_into_file+0x19>
lea    0xede(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
lea    0xed9(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%s=\22%s\22\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @write_into_file(i32* %0, i8* %1, i8* %2, i8** %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8**
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8** %3, i8*** %8
%9 = load i8**, i8*** %8
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load i32*, i32** %5
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15)
br label %21
17: ; preds = %4
%18 = load i32*, i32** %5
%19 = load i8*, i8** %6
%20 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %12
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s=\22%s\22\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @write_into_file(i32* nocapture %0, i8* %1, i8* %2, i8** nocapture readnone %3) {
%5 = icmp eq i8* %2, null
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
br label %10
8: ; preds = %4
%9 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main() {
  char blah[33] = "01234567890123456789";
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x21,%edx
call   1030 <memcpy@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@__const.main.blah = [33 x i8] c"01234567890123456789\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [33 x i8]
store i32 0, i32* %1
%3 = bitcast [33 x i8]* %2 to i8*
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct can_frame {
  int /*<<< orphan*/ *data;
};

/* Variables and functions */
void sdo_set_subindex(struct can_frame *frame, uint8_t subindex) {
  frame->data[1 + 2] = subindex;
}


x86 assembly (clang, -O0):
<sdo_set_subindex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdo_set_subindex>:
mov    (%rdi),%rax
mov    %esi,0xc(%rax)
ret

LLVM IR (-O0):
%struct.can_frame = type { i32* }
define void @sdo_set_subindex(%struct.can_frame* %0, i32 %1) {
%3 = alloca %struct.can_frame*
%4 = alloca i32
store %struct.can_frame* %0, %struct.can_frame** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load %struct.can_frame*, %struct.can_frame** %3
%7 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %6, i32 0, i32 0
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 3
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
%struct.can_frame = type { i32* }
define void @sdo_set_subindex(%struct.can_frame* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %0, i64 0, i32 0
%4 = load i32*, i32** %3
%5 = getelementptr inbounds i32, i32* %4, i64 3
store i32 %1, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void henry() {
  int a;
  printf("In henry()\n");
  goto inner;
  {
    int b;
  inner:
    b = 1234;
    printf("b = %d\n", b);
  }
  printf("done\n");
}


x86 assembly (clang, -O0):
<henry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x4d2,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<henry>:
push   %rax
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x4d2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"In henry()\0A\00"
@.str.1 = [8 x i8] c"b = %d\0A\00"
@.str.2 = [6 x i8] c"done\0A\00"
define void @henry() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0
store i32 1234, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"b = %d\0A\00"
@str = [11 x i8] c"In henry()\00"
@str.3 = [5 x i8] c"done\00"
define void @henry() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1234)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.3, i64 0, i64 0))
ret void
}