xunge/DecIR huggingface dataset:
int _contains_semicolon(const char *z, int N) {
  int i;
  for (i = 0; i < N; i++) {
    if (z[i] == ';')
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_contains_semicolon>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1152 <_contains_semicolon+0x52>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    113f <_contains_semicolon+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1159 <_contains_semicolon+0x59>
jmp    1144 <_contains_semicolon+0x44>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <_contains_semicolon+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_contains_semicolon>:
test   %esi,%esi
jle    111f <_contains_semicolon+0x1f>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpb   $0x3b,(%rdi,%rcx,1)
je     1122 <_contains_semicolon+0x22>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <_contains_semicolon+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @_contains_semicolon(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 59
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %14, label %6
14: ; preds = %8, %6, %2
%15 = phi i32 [ 0, %2 ], [ 0, %6 ], [ 1, %8 ]
ret i32 %15
}
int extract_cr_rn(unsigned long local_cr, unsigned long rn) {
  unsigned int masked_cr;
  unsigned long shifted_value;
  shifted_value = local_cr >> (((7 - rn) * 4));
  masked_cr = shifted_value & 0xf;
  return masked_cr;
}


x86 assembly (clang, -O0):
<extract_cr_rn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
sub    -0x10(%rbp),%rcx
shl    $0x2,%rcx
shr    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
and    $0xf,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_cr_rn>:
mov    %rdi,%rax
shl    $0x2,%esi
mov    $0x1c,%cl
sub    %sil,%cl
shr    %cl,%rax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @extract_cr_rn(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = sub i64 7, %8
%10 = mul i64 %9, 4
%11 = lshr i64 %7, %10
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = and i64 %12, 15
%14 = trunc i64 %13 to i32
store i32 %14, i32* %5
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
define i32 @extract_cr_rn(i64 %0, i64 %1) {
%3 = mul i64 %1, -4
%4 = add i64 %3, 28
%5 = lshr i64 %0, %4
%6 = trunc i64 %5 to i32
%7 = and i32 %6, 15
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int zap_file(char *filename) {
  FILE *f;
  f = fopen(filename, "w");
  if (!f) {
    return 0;
  }
  fclose(f);
  return 1;
}


x86 assembly (clang, -O0):
<zap_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <zap_file+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1167 <zap_file+0x47>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zap_file>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <zap_file+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
define i32 @zap_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
void g5_close() {}


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

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

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

LLVM IR (-O2):
define void @g5_close() {
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void getnow(struct timeval *nowP, struct timeval *nowP2) {
  if (nowP != NULL) {
    *nowP2 = *nowP;
  } else {
    (void)gettimeofday(nowP2, NULL);
  }
}


x86 assembly (clang, -O0):
<getnow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113c <getnow+0x2c>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
jmp    1149 <getnow+0x39>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnow>:
test   %rdi,%rdi
je     111a <getnow+0xa>
mov    (%rdi),%eax
mov    %eax,(%rsi)
ret
mov    %rsi,%rdi
xor    %esi,%esi
jmp    1030 <gettimeofday@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
define void @getnow(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = icmp ne %struct.timeval* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load %struct.timeval*, %struct.timeval** %4
%9 = load %struct.timeval*, %struct.timeval** %3
%10 = bitcast %struct.timeval* %8 to i8*
%11 = bitcast %struct.timeval* %9 to i8*
br label %15
12: ; preds = %2
%13 = load %struct.timeval*, %struct.timeval** %4
%14 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
br label %15
15: ; preds = %12, %7
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @getnow(%struct.timeval* %0, %struct.timeval* nocapture %1) {
%3 = icmp eq %struct.timeval* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = getelementptr %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %5
store i32 %7, i32* %6
br label %10
8: ; preds = %2
%9 = tail call i32 @gettimeofday(%struct.timeval* %1, i32* null)
br label %10
10: ; preds = %8, %4
ret void
}
unsigned int count_ones(unsigned char _b) {
  unsigned int i, n = 0;
  for (i = 0; i < 8; i++) {
    n += _b & 0x01;
    _b >>= 1;
  }
  return n;
}


x86 assembly (clang, -O0):
<count_ones>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jae    1147 <count_ones+0x47>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1118 <count_ones+0x18>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_ones>:
mov    %edi,%eax
and    $0x1,%al
mov    %edi,%ecx
shr    %cl
and    $0x1,%cl
add    %al,%cl
mov    %edi,%eax
shr    $0x2,%al
and    $0x1,%al
add    %cl,%al
mov    %edi,%ecx
shr    $0x3,%cl
and    $0x1,%cl
add    %al,%cl
mov    %edi,%eax
shr    $0x4,%al
and    $0x1,%al
add    %cl,%al
mov    %edi,%ecx
shr    $0x5,%cl
and    $0x1,%cl
add    %al,%cl
mov    %edi,%eax
shr    $0x6,%al
and    $0x1,%al
add    %cl,%al
movzbl %al,%ecx
shr    $0x7,%dil
movzbl %dil,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @count_ones(i8 zeroext %0) {
%2 = and i8 %0, 1
%3 = lshr i8 %0, 1
%4 = and i8 %3, 1
%5 = add nuw nsw i8 %2, %4
%6 = lshr i8 %0, 2
%7 = and i8 %6, 1
%8 = add nuw nsw i8 %5, %7
%9 = lshr i8 %0, 3
%10 = and i8 %9, 1
%11 = add nuw nsw i8 %8, %10
%12 = lshr i8 %0, 4
%13 = and i8 %12, 1
%14 = add nuw nsw i8 %11, %13
%15 = lshr i8 %0, 5
%16 = and i8 %15, 1
%17 = add nuw nsw i8 %14, %16
%18 = lshr i8 %0, 6
%19 = and i8 %18, 1
%20 = add nuw nsw i8 %17, %19
%21 = zext i8 %20 to i32
%22 = lshr i8 %0, 7
%23 = zext i8 %22 to i32
%24 = add nuw nsw i32 %21, %23
ret i32 %24
}
int search(const int vc[], int key, int no) {
  int i = 0;
  while (1) {
    if (i == no)
      return (-1);
    if (vc[i] == key)
      return (i);
    i++;
  }
}


x86 assembly (clang, -O0):
<search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    112d <search+0x2d>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <search+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    114c <search+0x4c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <search+0x5a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <search+0x15>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search>:
mov    $0xffffffff,%eax
test   %edx,%edx
je     111e <search+0x1e>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %esi,(%rdi,%rcx,4)
je     111f <search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <search+0x10>
ret
mov    %ecx,%eax
ret

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

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

/* Variables and functions */
void convert_nth_position(uint32_t *number, int position) {
  *number ^= (1 << position);
}


x86 assembly (clang, -O0):
<convert_nth_position>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_nth_position>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @convert_nth_position(i32* nocapture %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = load i32, i32* %0
%5 = xor i32 %4, %3
store i32 %5, i32* %0
ret void
}
int _strlen(const char *str, int max) {
  char *s = (char *)str;
  while (*s++ && max--)
    ;
  if (max < 0)
    return 0;
  return s - str - 1;
}


x86 assembly (clang, -O0):
<_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1147 <_strlen+0x47>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1157 <_strlen+0x57>
jmp    115c <_strlen+0x5c>
jmp    1113 <_strlen+0x13>
cmpl   $0x0,-0x14(%rbp)
jge    1172 <_strlen+0x72>
movl   $0x0,-0x4(%rbp)
jmp    1184 <_strlen+0x84>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strlen>:
mov    %esi,%ecx
add    $0x1,%rcx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rax,1)
je     1120 <_strlen+0x20>
add    $0x1,%rax
cmp    %eax,%ecx
jne    1110 <_strlen+0x10>
jmp    1125 <_strlen+0x25>
cmp    %eax,%esi
js     1125 <_strlen+0x25>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @_strlen(i8* %0, i32 %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i32 [ %1, %2 ], [ %10, %9 ]
%5 = phi i8* [ %0, %2 ], [ %6, %9 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = icmp eq i8 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = add nsw i32 %4, -1
%11 = icmp eq i32 %4, 0
br i1 %11, label %19, label %3
12: ; preds = %3
%13 = icmp slt i32 %4, 0
%14 = ptrtoint i8* %6 to i64
%15 = ptrtoint i8* %0 to i64
%16 = xor i64 %15, -1
%17 = add i64 %14, %16
%18 = trunc i64 %17 to i32
br i1 %13, label %19, label %20
19: ; preds = %9, %12
br label %20
20: ; preds = %12, %19
%21 = phi i32 [ 0, %19 ], [ %18, %12 ]
ret i32 %21
}
/* Variables and functions */
int /*<<< orphan*/ send_ctrl_cmd(int);
void lcm_resume(void) { send_ctrl_cmd(0x29); }


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

x86 assembly (clang, -O2):
<lcm_resume>:
mov    $0x29,%edi
jmp    1030 <send_ctrl_cmd@plt>

LLVM IR (-O0):
define void @lcm_resume() {
%1 = call i32 @send_ctrl_cmd(i32 41)
ret void
}

LLVM IR (-O2):
define void @lcm_resume() {
%1 = tail call i32 @send_ctrl_cmd(i32 41)
ret void
}
int test_imm_B7int16_mem(short *val) {
  return ((*val) & (-0xB7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B7int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff49,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B7int16_mem>:
movzwl (%rdi),%eax
test   $0xff49,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B7int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -183
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t
hci_event_connection_packet_type_changed_get_status(const uint8_t *event) {
  return event[2];
}


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

x86 assembly (clang, -O2):
<hci_event_connection_packet_type_changed_get_status>:
mov    0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @hci_event_connection_packet_type_changed_get_status(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hci_event_connection_packet_type_changed_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;
struct buffer {
  int dummy;
};

/* Variables and functions */
int get16le(struct buffer *);
uint32_t get32le(struct buffer *input) {
  uint32_t ret;
  ret = get16le(input);
  ret |= get16le(input) << 16;
  return ret;
}


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

x86 assembly (clang, -O2):
<get32le>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get16le@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <get16le@plt>
shl    $0x10,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
define i32 @get32le(%struct.buffer* %0) {
%2 = alloca %struct.buffer*
%3 = alloca i32
store %struct.buffer* %0, %struct.buffer** %2
%4 = load %struct.buffer*, %struct.buffer** %2
%5 = call i32 @get16le(%struct.buffer* %4)
store i32 %5, i32* %3
%6 = load %struct.buffer*, %struct.buffer** %2
%7 = call i32 @get16le(%struct.buffer* %6)
%8 = shl i32 %7, 16
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define i32 @get32le(%struct.buffer* %0) {
%2 = tail call i32 @get16le(%struct.buffer* %0)
%3 = tail call i32 @get16le(%struct.buffer* %0)
%4 = shl i32 %3, 16
%5 = or i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ch_free_wrapper(void *p, void *ign) { free(p); }


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

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

LLVM IR (-O0):
define void @ch_free_wrapper(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 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @ch_free_wrapper(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int ENXIO;
int pm8921_bms_get_fcc(void) { return -ENXIO; }


x86 assembly (clang, -O0):
<pm8921_bms_get_fcc>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    0x2ed3(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm8921_bms_get_fcc>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENXIO = global i32 0
define i32 @pm8921_bms_get_fcc() {
%1 = load i32, i32* @ENXIO
%2 = sub nsw i32 0, %1
ret i32 %2
}

LLVM IR (-O2):
@ENXIO = global i32 0
define i32 @pm8921_bms_get_fcc() {
%1 = load i32, i32* @ENXIO
%2 = sub nsw i32 0, %1
ret i32 %2
}
void OP_ST(bytemode, sizeflag) int bytemode;
int sizeflag;
{ oappend("%st"); }


x86 assembly (clang, -O0):
<OP_ST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <oappend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP_ST>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <oappend@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%st\00"
define void @OP_ST(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @oappend to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%st\00"
define void @OP_ST(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @oappend to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ do_add_padding(char *, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int size;
  if (argc != 3) {
    printf("Usage: padding <source file> <size> \n");
    return -1;
  }
  size = atoi(argv[2]);
  do_add_padding(argv[1], size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1030 <do_add_padding@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    1151 <main+0x21>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1050 <atoi@plt>
mov    0x8(%rbx),%rdi
mov    %eax,%esi
call   1040 <do_add_padding@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Usage: padding <source file> <size> \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %21
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i32, i32* %6
%20 = call i32 @do_add_padding(i8* %18, i32 %19)
store i32 0, i32* %3
br label %21
21: ; preds = %11, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@str = [37 x i8] c"Usage: padding <source file> <size> \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %13
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @do_add_padding(i8* %11, i32 %9)
br label %13
13: ; preds = %6, %4
%14 = phi i32 [ -1, %4 ], [ 0, %6 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ Elf64_Versym;
typedef int /*<<< orphan*/ Elf64_Half;

/* Variables and functions */
int elfrw_write_Half(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
int elfrw_write_Versym(FILE *fp, Elf64_Versym const *out) {
  return elfrw_write_Half(fp, (Elf64_Half const *)out);
}


x86 assembly (clang, -O0):
<elfrw_write_Versym>:
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 <elfrw_write_Half@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @elfrw_write_Versym(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 = call i32 @elfrw_write_Half(i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @elfrw_write_Versym(i32* %0, i32* %1) {
%3 = tail call i32 @elfrw_write_Half(i32* %0, i32* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ wiznetRegReadWord(int /*<<< orphan*/, int);
uint16_t wiznetGetSocketRXReceivedSize(uint8_t socket) {
  return wiznetRegReadWord(socket, (0x0000 + 0x0026));
}


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

x86 assembly (clang, -O2):
<wiznetGetSocketRXReceivedSize>:
mov    $0x26,%esi
jmp    1030 <wiznetRegReadWord@plt>

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

LLVM IR (-O2):
define i32 @wiznetGetSocketRXReceivedSize(i32 %0) {
%2 = tail call i32 @wiznetRegReadWord(i32 %0, i32 38)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("Usage: wicap [options] <listening port>\n");
  printf("Options:\n");
  printf("  -o\t\tWrite captured output to stdout\n");
  printf("  -a\t\tDon't exclude Wicap traffic (use with caution)\n");
  printf("  -?\t\tPrint this usage information\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf45(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf44(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Usage: wicap [options] <listening port>\0A\00"
@.str.1 = [10 x i8] c"Options:\0A\00"
@.str.2 = [39 x i8] c" -o\09\09Write captured output to stdout\0A\00"
@.str.3 = [54 x i8] c" -a\09\09Don't exclude Wicap traffic (use with caution)\0A\00"
@.str.4 = [36 x i8] c" -?\09\09Print this usage information\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [40 x i8] c"Usage: wicap [options] <listening port>\00"
@str.5 = [9 x i8] c"Options:\00"
@str.6 = [38 x i8] c" -o\09\09Write captured output to stdout\00"
@str.7 = [53 x i8] c" -a\09\09Don't exclude Wicap traffic (use with caution)\00"
@str.8 = [35 x i8] c" -?\09\09Print this usage information\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ce_coroutine_block();
int ce_wait() {
  ce_coroutine_block();
  return 0;
}


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

x86 assembly (clang, -O2):
<ce_wait>:
push   %rax
xor    %eax,%eax
call   1030 <ce_coroutine_block@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ce_wait() {
%1 = call i32 (...) @ce_coroutine_block()
ret i32 0
}

LLVM IR (-O2):
define i32 @ce_wait() {
%1 = tail call i32 (...) @ce_coroutine_block()
ret i32 0
}
int sampleFunc(int A) {
  if (A > 0)
    return A;
  return 0;
}


x86 assembly (clang, -O0):
<sampleFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    111c <sampleFunc+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1123 <sampleFunc+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sampleFunc>:
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @sampleFunc(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ dup2(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ start(int, char **);
int module_generate(int param_c, char *params[]) {
  FILE *err_log_file = fopen("error_log.txt", "a");
  dup2(fileno(err_log_file), STDERR_FILENO);
  start(param_c, params);
  return 1;
}


x86 assembly (clang, -O0):
<module_generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fileno@plt>
mov    %eax,%edi
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <start@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_generate>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb1(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rdi
call   1050 <fileno@plt>
mov    0x2e76(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1030 <dup2@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <start@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"error_log.txt\00"
@.str.1 = [2 x i8] c"a\00"
@STDERR_FILENO = global i32 0
define i32 @module_generate(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %5
%7 = load i32*, i32** %5
%8 = call i32 @fileno(i32* %7)
%9 = load i32, i32* @STDERR_FILENO
%10 = call i32 @dup2(i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = load i8**, i8*** %4
%13 = call i32 @start(i32 %11, i8** %12)
ret i32 1
}

LLVM IR (-O2):
@.str = [14 x i8] c"error_log.txt\00"
@.str.1 = [2 x i8] c"a\00"
@STDERR_FILENO = global i32 0
define i32 @module_generate(i32 %0, i8** %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @fileno(i32* %3)
%5 = load i32, i32* @STDERR_FILENO
%6 = tail call i32 @dup2(i32 %4, i32 %5)
%7 = tail call i32 @start(i32 %0, i8** %1)
ret i32 1
}
void *tool_mpi_init() {}


x86 assembly (clang, -O0):
<tool_mpi_init>:
push   %rbp
mov    %rsp,%rbp
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @tool_mpi_init() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define noalias i8* @tool_mpi_init() {
ret i8* undef
}
void rop3_205_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | T;
  stk2 = ~stk2;
  stk1 = S | stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_205_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_205_0_1>:
mov    (%rdi),%al
mov    %esi,%ecx
not    %cl
and    %dl,%cl
and    %al,%cl
or     %dl,%al
not    %al
or     %sil,%al
not    %dl
and    %al,%dl
or     %sil,%cl
or     %dl,%cl
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_205_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = or i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = and i32 %27, %29
%31 = load i8, i8* %7
%32 = zext i8 %31 to i32
%33 = load i8, i8* %6
%34 = zext i8 %33 to i32
%35 = xor i32 %34, -1
%36 = and i32 %32, %35
%37 = or i32 %30, %36
%38 = load i8, i8* %6
%39 = zext i8 %38 to i32
%40 = load i8, i8* %5
%41 = zext i8 %40 to i32
%42 = xor i32 %41, -1
%43 = and i32 %39, %42
%44 = load i8*, i8** %4
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = and i32 %43, %46
%48 = or i32 %37, %47
%49 = trunc i32 %48 to i8
%50 = load i8*, i8** %4
store i8 %49, i8* %50
ret void
}

LLVM IR (-O2):
define void @rop3_205_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %2
%6 = xor i8 %5, -1
%7 = or i8 %6, %1
%8 = xor i8 %2, -1
%9 = and i8 %7, %8
%10 = xor i8 %1, -1
%11 = and i8 %10, %2
%12 = and i8 %11, %4
%13 = or i8 %12, %1
%14 = or i8 %13, %9
store i8 %14, i8* %0
ret void
}
void avio_close() {}


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

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

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

LLVM IR (-O2):
define void @avio_close() {
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
scalar_t__ teste(int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int gera_primo() {
  int num = 10;
  srand(time(NULL));
  while (teste(num)) {
    num = rand();
  }
  return num;
}


x86 assembly (clang, -O0):
<gera_primo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x4(%rbp),%edi
call   1030 <teste@plt>
cmp    $0x0,%rax
je     1180 <gera_primo+0x40>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x4(%rbp)
jmp    115f <gera_primo+0x1f>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gera_primo>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0xa,%ebx
mov    $0xa,%edi
nopl   0x0(%rax)
call   1030 <teste@plt>
test   %rax,%rax
je     1177 <gera_primo+0x37>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
mov    %eax,%edi
jmp    1160 <gera_primo+0x20>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gera_primo() {
%1 = alloca i32
store i32 10, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %1
%6 = call i64 @teste(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 (...) @rand()
store i32 %9, i32* %1
br label %4
10: ; preds = %4
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @gera_primo() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i64 @teste(i32 10)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0, %5
%6 = tail call i32 (...) @rand()
%7 = tail call i64 @teste(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %0
%10 = phi i32 [ 10, %0 ], [ %6, %5 ]
ret i32 %10
}
int issetugid(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @issetugid() {
ret i32 1
}

LLVM IR (-O2):
define i32 @issetugid() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: altqstat [-enrs] [-c count] [-w wait] [-i "
                  "interface|-I input_interface]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [80 x i8] c"usage: altqstat [-enrs] [-c count] [-w wait] [-i interface|-I input_interface]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [80 x i8] c"usage: altqstat [-enrs] [-c count] [-w wait] [-i interface|-I input_interface]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_B4uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xB4 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B4uint64_midword_mem>:
testb  $0xb4,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B4uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 11796480
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned castTest(int X) { return X; }


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

x86 assembly (clang, -O2):
<castTest>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @castTest(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
double Game24Points(int, int, int, int);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *, int *, int *);
double Game24PointsEx(char *str) {
  int a, b, c, d;
  sscanf(str, "%d %d %d %d", &a, &b, &c, &d);
  return Game24Points(a, b, c, d);
}


x86 assembly (clang, -O0):
<Game24PointsEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
call   1030 <sscanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1040 <Game24Points@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Game24PointsEx>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
call   1030 <sscanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
call   1040 <Game24Points@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d %d %d %d\00"
define double @Game24PointsEx(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call double @Game24Points(i32 %9, i32 %10, i32 %11, i32 %12)
ret double %13
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
define double @Game24PointsEx(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call double @Game24Points(i32 %11, i32 %12, i32 %13, i32 %14)
ret double %15
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void nr_free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch) {
  free((char *)(b + nrl - 1));
}


x86 assembly (clang, -O0):
<nr_free_convert_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nr_free_convert_matrix>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @nr_free_convert_matrix(float** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca float**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store float** %0, float*** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load float**, float*** %6
%12 = load i64, i64* %7
%13 = getelementptr inbounds float*, float** %11, i64 %12
%14 = getelementptr inbounds float*, float** %13, i64 -1
%15 = bitcast float** %14 to i8*
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
define void @nr_free_convert_matrix(float** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds float*, float** %0, i64 %1
%7 = getelementptr inbounds float*, float** %6, i64 -1
%8 = bitcast float** %7 to i8*
%9 = tail call i32 @free(i8* %8)
ret void
}