xunge/DecIR huggingface dataset:
int ffs(int value) { return __builtin_ffs(value); }


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
bsf    %edi,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.cttz.i32(i32 %3, i1 true)
%5 = add i32 %4, 1
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, i32 0, i32 %5
ret i32 %7
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = add nuw nsw i32 %2, 1
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 0, i32 %3
ret i32 %5
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct clause_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_pop_front(struct genlist *);
void clause_list_pop_front(struct clause_list *tthis) {
  genlist_pop_front((struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<clause_list_pop_front>:
jmp    1030 <genlist_pop_front@plt>

LLVM IR (-O0):
%struct.clause_list = type { i32 }
%struct.genlist = type { i32 }
define void @clause_list_pop_front(%struct.clause_list* %0) {
%2 = alloca %struct.clause_list*
store %struct.clause_list* %0, %struct.clause_list** %2
%3 = load %struct.clause_list*, %struct.clause_list** %2
%4 = bitcast %struct.clause_list* %3 to %struct.genlist*
%5 = call i32 @genlist_pop_front(%struct.genlist* %4)
ret void
}

LLVM IR (-O2):
%struct.clause_list = type { i32 }
%struct.genlist = type { i32 }
define void @clause_list_pop_front(%struct.clause_list* %0) {
%2 = bitcast %struct.clause_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_pop_front(%struct.genlist* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, char const *);
int /*<<< orphan*/ stdout;
void sqlLog(void *pNotUsed, int iErrCode, const char *zMsg) {
  printf("LOG: (%d) %s\n", iErrCode, zMsg);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<sqlLog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlLog>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"LOG: (%d) %s\0A\00"
@stdout = global i32 0
define void @sqlLog(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = load i8*, i8** %6
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"LOG: (%d) %s\0A\00"
@stdout = global i32 0
define void @sqlLog(i8* nocapture readnone %0, i32 %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
int init_widgets(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @init_widgets() {
ret i32 0
}

LLVM IR (-O2):
define i32 @init_widgets() {
ret i32 0
}
unsigned NullTerminatedPointerArrayLength(void **array) {
  unsigned ret = 0;
  if (array) {
    while (*array) {
      ret++;
      array++;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<NullTerminatedPointerArrayLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114c <NullTerminatedPointerArrayLength+0x4c>
jmp    111f <NullTerminatedPointerArrayLength+0x1f>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1147 <NullTerminatedPointerArrayLength+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    111f <NullTerminatedPointerArrayLength+0x1f>
jmp    114c <NullTerminatedPointerArrayLength+0x4c>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NullTerminatedPointerArrayLength>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <NullTerminatedPointerArrayLength+0x1c>
cmpq   $0x0,(%rdi)
je     111c <NullTerminatedPointerArrayLength+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <NullTerminatedPointerArrayLength+0x10>
ret

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

LLVM IR (-O2):
define i32 @NullTerminatedPointerArrayLength(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8** [ %10, %6 ], [ %0, %3 ]
%9 = add i32 %7, 1
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
int test_imm_23int64_midword_reg(long long val) {
  return ((val >> 16) & (0x23 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_23int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x23,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_23int64_midword_reg>:
test   $0x230000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_23int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 35
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_23int64_midword_reg(i64 %0) {
%2 = and i64 %0, 2293760
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ w5100_readSIPR(int /*<<< orphan*/ *);
void w5100_getIPAddress(uint8_t *addr) { w5100_readSIPR(addr); }


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

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

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

LLVM IR (-O2):
define void @w5100_getIPAddress(i32* %0) {
%2 = tail call i32 @w5100_readSIPR(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ oled_write_byte(int);
void oled_set_page_address(unsigned char page) { oled_write_byte(0xb0 | page); }


x86 assembly (clang, -O0):
<oled_set_page_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
or     $0xb0,%edi
call   1030 <oled_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oled_set_page_address>:
or     $0xb0,%dil
movzbl %dil,%edi
jmp    1030 <oled_write_byte@plt>

LLVM IR (-O0):
define void @oled_set_page_address(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = or i32 176, %4
%6 = call i32 @oled_write_byte(i32 %5)
ret void
}

LLVM IR (-O2):
define void @oled_set_page_address(i8 zeroext %0) {
%2 = or i8 %0, -80
%3 = zext i8 %2 to i32
%4 = tail call i32 @oled_write_byte(i32 %3)
ret void
}
unsigned Maxu(unsigned a, unsigned b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<Maxu>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    1121 <Maxu+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <Maxu+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Maxu>:
mov    %esi,%eax
cmp    %esi,%edi
cmova  %edi,%eax
ret

LLVM IR (-O0):
define i32 @Maxu(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp ugt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @Maxu(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ customEventHandler(char *, char *);
void raiseEvent(char *szEventName, char *szText) {
  customEventHandler(szEventName, szText);
}


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

x86 assembly (clang, -O2):
<raiseEvent>:
jmp    1030 <customEventHandler@plt>

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

LLVM IR (-O2):
define void @raiseEvent(i8* %0, i8* %1) {
%3 = tail call i32 @customEventHandler(i8* %0, i8* %1)
ret void
}
/* Type definitions */
struct stat {
  long st_size;
};

/* Variables and functions */
scalar_t__ fileExists(char const *);
scalar_t__ stat(char const *, struct stat *);
long getFileSize(const char *fileName) {
  struct stat st;
  if (fileExists(fileName)) {
    if (stat(fileName, &st) == 0) {
      return st.st_size;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<getFileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fileExists@plt>
cmp    $0x0,%rax
je     1168 <getFileSize+0x48>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jne    1163 <getFileSize+0x43>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1170 <getFileSize+0x50>
jmp    1168 <getFileSize+0x48>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileSize>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <fileExists@plt>
mov    $0xffffffffffffffff,%r14
test   %rax,%rax
je     114c <getFileSize+0x2c>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <stat@plt>
test   %rax,%rax
jne    114c <getFileSize+0x2c>
mov    (%rsp),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i64 @getFileSize(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @fileExists(i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @stat(i8* %9, %struct.stat* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%14 = load i64, i64* %13
store i64 %14, i64* %2
br label %17
15: ; preds = %8
br label %16
16: ; preds = %15, %1
store i64 -1, i64* %2
br label %17
17: ; preds = %16, %12
%18 = load i64, i64* %2
ret i64 %18
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i64 @getFileSize(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = tail call i64 @fileExists(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = call i64 @stat(i8* %0, %struct.stat* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%11 = load i64, i64* %10
br label %12
12: ; preds = %1, %6, %9
%13 = phi i64 [ %11, %9 ], [ -1, %6 ], [ -1, %1 ]
ret i64 %13
}
/* Variables and functions */
int find_gcd(int, int);
int find_lcm(int i, int j) { return i * j / find_gcd(i, j); }


x86 assembly (clang, -O0):
<find_lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <find_gcd@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_lcm>:
push   %rbx
mov    %esi,%ebx
imul   %edi,%ebx
call   1030 <find_gcd@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @find_lcm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @find_gcd(i32 %8, i32 %9)
%11 = sdiv i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @find_lcm(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @find_gcd(i32 %0, i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
/* Variables and functions */
char *xmalloc(int);
int /*<<< orphan*/ xread(int, ...);
char *xread_str(int fd) {
  char *s;
  int l;
  xread(fd, &l, sizeof(int));
  s = xmalloc(l + 1);
  if (l > 0)
    xread(fd, s, l + 1);
  return s;
}


x86 assembly (clang, -O0):
<xread_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <xread@plt>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1030 <xmalloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    116b <xread_str+0x4b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    $0x0,%al
call   1040 <xread@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xread_str>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <xread@plt>
mov    0x4(%rsp),%edi
add    $0x1,%edi
call   1030 <xmalloc@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%edx
test   %edx,%edx
jle    115c <xread_str+0x3c>
add    $0x1,%edx
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <xread@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @xread_str(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i32, ...) @xread(i32 %5, i32* %4, i64 4)
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = call i8* @xmalloc(i32 %8)
store i8* %9, i8** %3
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %1
%13 = load i32, i32* %2
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = call i32 (i32, ...) @xread(i32 %13, i8* %14, i32 %16)
br label %18
18: ; preds = %12, %1
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
define i8* @xread_str(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 (i32, ...) @xread(i32 %0, i32* %2, i64 4)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = call i8* @xmalloc(i32 %6)
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = add nuw nsw i32 %8, 1
%12 = call i32 (i32, ...) @xread(i32 %0, i8* %7, i32 %11)
br label %13
13: ; preds = %10, %1
ret i8* %7
}
/* Variables and functions */
size_t sumOfPowerOfTwoIndex(size_t n) {
  size_t ret = 0;
  while (n) {
    n >>= 1;
    ++ret;
  }
  return ret;
}


x86 assembly (clang, -O0):
<sumOfPowerOfTwoIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <sumOfPowerOfTwoIndex+0x38>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <sumOfPowerOfTwoIndex+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfPowerOfTwoIndex>:
xor    %eax,%eax
test   %rdi,%rdi
je     1120 <sumOfPowerOfTwoIndex+0x20>
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
shr    %rcx
add    $0x1,%rax
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <sumOfPowerOfTwoIndex+0x10>
ret

LLVM IR (-O0):
define i64 @sumOfPowerOfTwoIndex(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %3
br label %4
4: ; preds = %7, %1
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i64, i64* %2
%9 = lshr i64 %8, 1
store i64 %9, i64* %2
%10 = load i64, i64* %3
%11 = add i64 %10, 1
store i64 %11, i64* %3
br label %4
12: ; preds = %4
%13 = load i64, i64* %3
ret i64 %13
}

LLVM IR (-O2):
define i64 @sumOfPowerOfTwoIndex(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i64 %5, 1
%7 = add nuw nsw i64 %4, 1
%8 = icmp ult i64 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i64 [ 0, %1 ], [ %7, %3 ]
ret i64 %10
}
char getScancode() {
  char c = 0;
  do {
    {
      if (c > 0)
        return c;
    }
  } while (1);
}


x86 assembly (clang, -O0):
<getScancode>:
push   %rbp
mov    %rsp,%rbp
movb   $0x0,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jle    1120 <getScancode+0x20>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1134 <getScancode+0x34>
jmp    1125 <getScancode+0x25>
mov    $0x1,%al
test   $0x1,%al
jne    1108 <getScancode+0x8>
jmp    1134 <getScancode+0x34>
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getScancode>:
jmp    1100 <getScancode>

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

LLVM IR (-O2):
define signext i8 @getScancode() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ g(int, int);
int /*<<< orphan*/ h(int, int);
void f(int a, int x, int z) {
  if (z > 1)
    g(a, x);
  else
    h(5, a);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    114b <f+0x2b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <g@plt>
jmp    1158 <f+0x38>
mov    -0x4(%rbp),%esi
mov    $0x5,%edi
call   1030 <h@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
cmp    $0x2,%edx
jl     112e <f+0xe>
mov    %eax,%edi
jmp    1040 <g@plt>
mov    $0x5,%edi
mov    %eax,%esi
jmp    1030 <h@plt>

LLVM IR (-O0):
define void @f(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 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @g(i32 %10, i32 %11)
br label %16
13: ; preds = %3
%14 = load i32, i32* %4
%15 = call i32 @h(i32 5, i32 %14)
br label %16
16: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
define void @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 1
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @g(i32 %0, i32 %1)
br label %9
7: ; preds = %3
%8 = tail call i32 @h(i32 5, i32 %0)
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int info(char title[], int index) {
  printf("%s\nProblem %d\n", title, index);
  return 0;
}


x86 assembly (clang, -O0):
<info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<info>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s\0AProblem %d\0A\00"
define i32 @info(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s\0AProblem %d\0A\00"
define i32 @info(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret i32 0
}
int _dl_strcmp(const char *s1, const char *s2) {
  register unsigned char c1, c2;
  do {
    c1 = (unsigned char)*s1++;
    c2 = (unsigned char)*s2++;
    if (c1 == '\0')
      return c1 - c2;
  } while (c1 == c2);
  return c1 - c2;
}


x86 assembly (clang, -O0):
<_dl_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0x1a(%rbp)
movzbl -0x19(%rbp),%eax
cmp    $0x0,%eax
jne    1153 <_dl_strcmp+0x53>
movzbl -0x19(%rbp),%eax
movzbl -0x1a(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1175 <_dl_strcmp+0x75>
jmp    1158 <_dl_strcmp+0x58>
movzbl -0x19(%rbp),%eax
movzbl -0x1a(%rbp),%ecx
cmp    %ecx,%eax
je     110c <_dl_strcmp+0xc>
movzbl -0x19(%rbp),%eax
movzbl -0x1a(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dl_strcmp>:
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
test   %eax,%eax
je     1127 <_dl_strcmp+0x27>
add    $0x1,%rdx
cmp    %cl,%al
je     1110 <_dl_strcmp+0x10>
sub    %ecx,%eax
ret
xor    %eax,%eax
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @_dl_strcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %1, %2 ], [ %10, %9 ]
%5 = phi i8* [ %0, %2 ], [ %11, %9 ]
%6 = load i8, i8* %5
%7 = load i8, i8* %4
%8 = icmp eq i8 %6, 0
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = icmp eq i8 %6, %7
br i1 %12, label %3, label %13
13: ; preds = %9
%14 = zext i8 %6 to i32
br label %15
15: ; preds = %3, %13
%16 = phi i32 [ %14, %13 ], [ 0, %3 ]
%17 = zext i8 %7 to i32
%18 = sub nsw i32 %16, %17
ret i32 %18
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t detexPack32RG16(uint32_t r16, uint32_t g16) {
  return r16 | (g16 << 16);
}


x86 assembly (clang, -O0):
<detexPack32RG16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<detexPack32RG16>:
mov    %esi,%eax
shl    $0x10,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @detexPack32RG16(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 %6, 16
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @detexPack32RG16(i32 %0, i32 %1) {
%3 = shl i32 %1, 16
%4 = or i32 %3, %0
ret i32 %4
}
char showCharWithIndex(int i, char *string) {
  char *temp = string;
  return temp[i];
}


x86 assembly (clang, -O0):
<showCharWithIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<showCharWithIndex>:
movslq %edi,%rax
mov    (%rsi,%rax,1),%al
ret

LLVM IR (-O0):
define signext i8 @showCharWithIndex(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @showCharWithIndex(i32 %0, i8* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i8, i8* %1, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage(void) { fprintf(stderr, "\nusage: npx <bytecode-file>\n\n"); }


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"\0Ausage: npx <bytecode-file>\0A\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"\0Ausage: npx <bytecode-file>\0A\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int safe_atou_full(char const *, int /*<<< orphan*/, unsigned int *);
int safe_atou(const char *s, unsigned *ret_u) {
  return safe_atou_full(s, 0, ret_u);
}


x86 assembly (clang, -O0):
<safe_atou>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <safe_atou_full@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_atou>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <safe_atou_full@plt>

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

LLVM IR (-O2):
define i32 @safe_atou(i8* %0, i32* %1) {
%3 = tail call i32 @safe_atou_full(i8* %0, i32 0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int fls(unsigned int);
int deg(unsigned int poly) { return fls(poly) - 1; }


x86 assembly (clang, -O0):
<deg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fls@plt>
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg>:
push   %rax
call   1030 <fls@plt>
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @deg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fls(i32 %3)
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @deg(i32 %0) {
%2 = tail call i32 @fls(i32 %0)
%3 = add nsw i32 %2, -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ enter(char *);
int /*<<< orphan*/ error(int);
int /*<<< orphan*/ out();
char symbol();
plp() {
  enter("plp");
  if (symbol() != '(')
    error(2);
  out();
}


x86 assembly (clang, -O0):
<plp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <enter@plt>
mov    $0x0,%al
call   1060 <symbol@plt>
movsbl %al,%eax
cmp    $0x28,%eax
je     1171 <plp+0x31>
mov    $0x2,%edi
call   1040 <error@plt>
mov    $0x0,%al
call   1050 <out@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plp>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <enter@plt>
xor    %eax,%eax
call   1060 <symbol@plt>
cmp    $0x28,%al
je     1162 <plp+0x22>
mov    $0x2,%edi
call   1040 <error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <out@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"plp\00"
define i32 @plp() {
%1 = alloca i32
%2 = call i32 @enter(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call signext i8 (...) @symbol()
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 40
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @error(i32 2)
br label %8
8: ; preds = %6, %0
%9 = call i32 (...) @out()
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"plp\00"
define i32 @plp() {
%1 = tail call i32 @enter(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 (...) @symbol()
%3 = icmp eq i8 %2, 40
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @error(i32 2)
br label %6
6: ; preds = %4, %0
%7 = tail call i32 (...) @out()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ rename(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 3)
    return 0;
  rename(argv[1], argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     113c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1158 <main+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <rename@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x3,%edi
jne    1127 <main+0x17>
push   %rax
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <rename@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @rename(i8* %6, i8* %8)
br label %10
10: ; preds = %2, %4
ret i32 0
}
void glClearBufferfv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glClearBufferfv() {
ret void
}
int check_nl_ct(char *input) {
  int i;
  int counter;
  i = 0;
  counter = 0;
  while (input[i]) {
    if (input[i] == '.')
      counter++;
    i++;
  }
  if (counter != 12)
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<check_nl_ct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1154 <check_nl_ct+0x54>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    1146 <check_nl_ct+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1116 <check_nl_ct+0x16>
cmpl   $0xc,-0x18(%rbp)
je     116a <check_nl_ct+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1171 <check_nl_ct+0x71>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_nl_ct>:
xor    %ecx,%ecx
jmp    1117 <check_nl_ct+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2e,%al
je     1110 <check_nl_ct+0x10>
test   %al,%al
jne    1113 <check_nl_ct+0x13>
xor    %eax,%eax
cmp    $0xc,%ecx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @check_nl_ct(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i64 [ %11, %9 ], [ 0, %1 ]
%4 = phi i32 [ %10, %9 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %12
i8 46, label %7
]
7: ; preds = %2
%8 = add nsw i32 %4, 1
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ %4, %2 ]
%11 = add nuw i64 %3, 1
br label %2
12: ; preds = %2
%13 = icmp eq i32 %4, 12
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Variables and functions */
int testLibCycleB1();
int testLibCycleA1(void) { return testLibCycleB1(); }


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

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

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

LLVM IR (-O2):
define i32 @testLibCycleA1() {
%1 = tail call i32 (...) @testLibCycleB1()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ AppUpdaterUSB();
int /*<<< orphan*/ ConfigureUSB();
void HandleUpdate() {
  ConfigureUSB();
  AppUpdaterUSB();
}


x86 assembly (clang, -O0):
<HandleUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ConfigureUSB@plt>
mov    $0x0,%al
call   1040 <AppUpdaterUSB@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HandleUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <ConfigureUSB@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <AppUpdaterUSB@plt>

LLVM IR (-O0):
define void @HandleUpdate() {
%1 = call i32 (...) @ConfigureUSB()
%2 = call i32 (...) @AppUpdaterUSB()
ret void
}

LLVM IR (-O2):
define void @HandleUpdate() {
%1 = tail call i32 (...) @ConfigureUSB()
%2 = tail call i32 (...) @AppUpdaterUSB()
ret void
}
void exit(int code) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <exit+0x7>

x86 assembly (clang, -O2):
<exit>:
jmp    1100 <exit>

LLVM IR (-O0):
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define void @exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Variables and functions */
char *GetMemory();
int /*<<< orphan*/ printf(char *);
void Test(void) {
  char *str = NULL;
  str = GetMemory();
  printf(str);
}


x86 assembly (clang, -O0):
<Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <GetMemory@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test>:
push   %rax
xor    %eax,%eax
call   1040 <GetMemory@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
define void @Test() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = call i8* (...) @GetMemory()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @printf(i8* %3)
ret void
}

LLVM IR (-O2):
define void @Test() {
%1 = tail call i8* (...) @GetMemory()
%2 = tail call i32 @printf(i8* dereferenceable(1) %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void printUsage(char *programName) {
  printf("\n Usage: %s [Character: n to not remove created semaphore, r to "
         "remove the created semaphore] [Integer: Number of Semphores > 0] "
         "[Integer...Integerx: Semaphor Value. The number of semaphore values "
         "(1,2,...x) MUST match the number of semaphores] \n\n",
         programName);
  exit(1);
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [248 x i8] c"\0A Usage: %s [Character: n to not remove created semaphore, r to remove the created semaphore] [Integer: Number of Semphores > 0] [Integer...Integerx: Semaphor Value. The number of semaphore values (1,2,...x) MUST match the number of semaphores] \0A\0A\00"
define void @printUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([248 x i8], [248 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [248 x i8] c"\0A Usage: %s [Character: n to not remove created semaphore, r to remove the created semaphore] [Integer: Number of Semphores > 0] [Integer...Integerx: Semaphor Value. The number of semaphore values (1,2,...x) MUST match the number of semaphores] \0A\0A\00"
define void @printUsage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([248 x i8], [248 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void EEPROM_write(unsigned char addr, unsigned char data) {}


x86 assembly (clang, -O0):
<EEPROM_write>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @EEPROM_write(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
ret void
}

LLVM IR (-O2):
define void @EEPROM_write(i8 zeroext %0, i8 zeroext %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
void *scrollBar(void *param) {
  while (1) {
    fprintf(stderr, "*");
    sleep(1);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<scrollBar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    112c <scrollBar+0xc>

x86 assembly (clang, -O2):
<scrollBar>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%r14
lea    0xece(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14),%edi
mov    %rbx,%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    1140 <scrollBar+0x20>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"*\00"
define i8* @scrollBar(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @sleep(i32 1)
br label %3
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"*\00"
define noalias i8* @scrollBar(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
br label %2
}
/* Variables and functions */
scalar_t__ getbits(int);
int getDMV() {
  if (getbits(1)) {
    return getbits(1) ? -1 : 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<getDMV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <getbits@plt>
cmp    $0x0,%rax
je     1152 <getDMV+0x42>
mov    $0x1,%edi
call   1030 <getbits@plt>
mov    %rax,%rdx
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <getDMV+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDMV>:
push   %rax
mov    $0x1,%edi
call   1030 <getbits@plt>
test   %rax,%rax
je     1134 <getDMV+0x24>
mov    $0x1,%edi
call   1030 <getbits@plt>
neg    %rax
sbb    %eax,%eax
or     $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getDMV() {
%1 = alloca i32
%2 = call i64 @getbits(i32 1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = call i64 @getbits(i32 1)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -1, i32 1
store i32 %8, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %4
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @getDMV() {
%1 = tail call i64 @getbits(i32 1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i64 @getbits(i32 1)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 1, i32 -1
br label %7
7: ; preds = %0, %3
%8 = phi i32 [ %6, %3 ], [ 0, %0 ]
ret i32 %8
}
int weak_test(int x) { return x + 1; }


x86 assembly (clang, -O0):
<weak_test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<weak_test>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @weak_test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @weak_test(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
void _printNL_bin(void) {}


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

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

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

LLVM IR (-O2):
define void @_printNL_bin() {
ret void
}
int test_imm_65uint16_reg(unsigned short val) {
  return ((val) & (0x65 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_65uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x65,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_65uint16_reg>:
test   $0x65,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_65uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 101
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_65uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 101
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}