xunge/DecIR huggingface dataset:
int imin(int x, int y) {
  if (x < y)
    return x;
  else
    return y;
}


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

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

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

LLVM IR (-O2):
define i32 @imin(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int ft_freetab(char **tab) {
  int i;
  if (!tab)
    return (0);
  i = -1;
  while (tab[++i])
    free(tab[i]);
  free(tab);
  return (0);
}


x86 assembly (clang, -O0):
<ft_freetab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <ft_freetab+0x23>
movl   $0x0,-0x4(%rbp)
jmp    117b <ft_freetab+0x6b>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116b <ft_freetab+0x5b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    113a <ft_freetab+0x2a>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_freetab>:
test   %rdi,%rdi
je     1150 <ft_freetab+0x40>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <ft_freetab+0x31>
lea    0x8(%r14),%rbx
nopl   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <ft_freetab+0x20>
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_freetab(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %15, 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 i64 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8* [ %11, %6 ], [ %4, %3 ]
tail call void @free(i8* %8)
%9 = add nuw nsw i64 %7, 1
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3
%14 = bitcast i8** %0 to i8*
tail call void @free(i8* %14)
br label %15
15: ; preds = %1, %13
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ kPrintString(int /*<<< orphan*/, int, char *);
void Main(void) {
  kPrintString(0, 3, "C Language Kernel Started~!!!");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x3,%esi
lea    0xede(%rip),%rdx
call   1030 <kPrintString@plt>
jmp    1127 <Main+0x17>

x86 assembly (clang, -O2):
<Main>:
push   %rax
lea    0xee8(%rip),%rdx
xor    %edi,%edi
mov    $0x3,%esi
call   1030 <kPrintString@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1130 <Main+0x20>

LLVM IR (-O0):
@.str = [30 x i8] c"C Language Kernel Started~!!!\00"
define void @Main() {
%1 = call i32 @kPrintString(i32 0, i32 3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [30 x i8] c"C Language Kernel Started~!!!\00"
define void @Main() {
%1 = tail call i32 @kPrintString(i32 0, i32 3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
scalar_t__ match_char(char const **, char const *, char);
int /*<<< orphan*/ match_xset_enc(char const **, char const *, int);
void match_path_absolute(char const **str, char const *end) {
  while (match_char(str, end, '/')) {
    match_xset_enc(str, end, (1 | 2 | 16 | 32 | 64));
  }
}


x86 assembly (clang, -O0):
<match_path_absolute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2f,%edx
call   1040 <match_char@plt>
cmp    $0x0,%rax
je     1163 <match_path_absolute+0x43>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x73,%edx
call   1030 <match_xset_enc@plt>
jmp    1130 <match_path_absolute+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_path_absolute>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    $0x2f,%edx
call   1040 <match_char@plt>
test   %rax,%rax
je     1157 <match_path_absolute+0x37>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x73,%edx
call   1030 <match_xset_enc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
jmp    1130 <match_path_absolute+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @match_path_absolute(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %10, %2
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %4
%8 = call i64 @match_char(i8** %6, i8* %7, i8 signext 47)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %4
%13 = call i32 @match_xset_enc(i8** %11, i8* %12, i32 115)
br label %5
14: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @match_path_absolute(i8** %0, i8* %1) {
%3 = tail call i64 @match_char(i8** %0, i8* %1, i8 signext 47)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2, %5
%6 = tail call i32 @match_xset_enc(i8** %0, i8* %1, i32 115)
%7 = tail call i64 @match_char(i8** %0, i8* %1, i8 signext 47)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void int_destroy(void *to_delete) { free(to_delete); }


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

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

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

LLVM IR (-O2):
define void @int_destroy(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
char bcdtobin(char val) {
  char high = (val & 0xF0) >> 4;
  char low = val & 0x0F;
  return (high * 10) + low;
}


x86 assembly (clang, -O0):
<bcdtobin>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x3(%rbp)
movsbl -0x2(%rbp),%eax
imul   $0xa,%eax,%eax
movsbl -0x3(%rbp),%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcdtobin>:
mov    %edi,%eax
shr    $0x4,%al
movzbl %al,%eax
and    $0xf,%dil
add    %eax,%eax
lea    (%rax,%rax,4),%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @bcdtobin(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = and i32 %6, 240
%8 = ashr i32 %7, 4
%9 = trunc i32 %8 to i8
store i8 %9, i8* %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = and i32 %11, 15
%13 = trunc i32 %12 to i8
store i8 %13, i8* %4
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = mul nsw i32 %15, 10
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = add nsw i32 %16, %18
%20 = trunc i32 %19 to i8
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @bcdtobin(i8 signext %0) {
%2 = lshr i8 %0, 4
%3 = and i8 %0, 15
%4 = mul nuw i8 %2, 10
%5 = add nuw i8 %4, %3
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int G4_f(char *s) {
  debug("G4_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<G4_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G4_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"G4_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G4_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [45 x i8] c"G4_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @G4_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
int Cyc_Absyn_rsubstitute_reentrant(struct _RegionHandle *rgn,
                                    struct Cyc_List_List *inst, int re) {
  return re;
}


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

x86 assembly (clang, -O2):
<Cyc_Absyn_rsubstitute_reentrant>:
mov    %edx,%eax
ret

LLVM IR (-O0):
%struct._RegionHandle = type opaque
%struct.Cyc_List_List = type opaque
define i32 @Cyc_Absyn_rsubstitute_reentrant(%struct._RegionHandle* %0, %struct.Cyc_List_List* %1, i32 %2) {
%4 = alloca %struct._RegionHandle*
%5 = alloca %struct.Cyc_List_List*
%6 = alloca i32
store %struct._RegionHandle* %0, %struct._RegionHandle** %4
store %struct.Cyc_List_List* %1, %struct.Cyc_List_List** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct._RegionHandle = type opaque
%struct.Cyc_List_List = type opaque
define i32 @Cyc_Absyn_rsubstitute_reentrant(%struct._RegionHandle* nocapture readnone %0, %struct.Cyc_List_List* nocapture readnone %1, i32 returned %2) {
ret i32 %2
}
double _n_4(void) { return 1.0; }


x86 assembly (clang, -O0):
<_n_4>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_n_4>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @_n_4() {
ret double 1.000000e+00
}

LLVM IR (-O2):
define double @_n_4() {
ret double 1.000000e+00
}
/* Variables and functions */
int isPowerOfTwo(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", isPowerOfTwo(1));
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <isPowerOfTwo@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @isPowerOfTwo(i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void retx_set_seqnum(uint8_t *p_retx, uint16_t i_seqnum) {
  p_retx[4] = i_seqnum >> 8;
  p_retx[5] = i_seqnum & 0xff;
}


x86 assembly (clang, -O0):
<retx_set_seqnum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<retx_set_seqnum>:
movzbl %sil,%eax
sar    $0x8,%esi
mov    %esi,0x10(%rdi)
mov    %eax,0x14(%rdi)
ret

LLVM IR (-O0):
define void @retx_set_seqnum(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 = ashr i32 %5, 8
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 4
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = and i32 %9, 255
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 5
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @retx_set_seqnum(i32* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %3, i32* %4
%5 = and i32 %1, 255
%6 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %5, i32* %6
ret void
}
/* Variables and functions */
char getchar();
char *tg_newstring(int);
char *tg_getchar() {
  char c = getchar();
  char *p = tg_newstring(1);
  p[0] = c;
  p[1] = '\0';
  return p;
}


x86 assembly (clang, -O0):
<tg_getchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
call   1030 <tg_newstring@plt>
mov    %rax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tg_getchar>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1030 <tg_newstring@plt>
mov    %bl,(%rax)
movb   $0x0,0x1(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @tg_getchar() {
%1 = alloca i8
%2 = alloca i8*
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = call i8* @tg_newstring(i32 1)
store i8* %4, i8** %2
%5 = load i8, i8* %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 %5, i8* %7
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %9
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
define i8* @tg_getchar() {
%1 = tail call signext i8 (...) @getchar()
%2 = tail call i8* @tg_newstring(i32 1)
store i8 %1, i8* %2
%3 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %3
ret i8* %2
}
int testExtern() {
  extern long var;
  return var;
}


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

x86 assembly (clang, -O2):
<testExtern>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@var = external global i64
define i32 @testExtern() {
%1 = load i64, i64* @var
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
@var = external global i64
define i32 @testExtern() {
%1 = load i64, i64* @var
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ opsem(int, int);
void up(int sem) { opsem(sem, +1); }


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

x86 assembly (clang, -O2):
<up>:
mov    $0x1,%esi
jmp    1030 <opsem@plt>

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

LLVM IR (-O2):
define void @up(i32 %0) {
%2 = tail call i32 @opsem(i32 %0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pk_put_nyb(int);
void pk_put_long(int n) {
  if (n >= 16) {
    pk_put_nyb(0);
    pk_put_long(n / 16);
  }
  pk_put_nyb(n % 16);
}


x86 assembly (clang, -O0):
<pk_put_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jl     114e <pk_put_long+0x2e>
xor    %edi,%edi
call   1030 <pk_put_nyb@plt>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <pk_put_long@plt>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <pk_put_nyb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pk_put_long>:
push   %rbx
mov    %edi,%ebx
cmp    $0x10,%edi
jl     1139 <pk_put_long+0x19>
xor    %edi,%edi
call   1030 <pk_put_nyb@plt>
mov    %ebx,%edi
shr    $0x4,%edi
call   1040 <pk_put_long@plt>
lea    0xf(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff0,%eax
sub    %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <pk_put_nyb@plt>

LLVM IR (-O0):
define void @pk_put_long(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 16
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 @pk_put_nyb(i32 0)
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 16
br label %9
9: ; preds = %5, %1
%10 = load i32, i32* %2
%11 = srem i32 %10, 16
%12 = call i32 @pk_put_nyb(i32 %11)
ret void
}

LLVM IR (-O2):
define void @pk_put_long(i32 %0) {
%2 = icmp sgt i32 %0, 15
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @pk_put_nyb(i32 0)
%5 = lshr i32 %0, 4
tail call void @pk_put_long(i32 %5)
br label %6
6: ; preds = %3, %1
%7 = srem i32 %0, 16
%8 = tail call i32 @pk_put_nyb(i32 %7)
ret void
}
int hasdirsep(s1)
char *s1;
{
  if (strchr(s1, '/'))
    return 1;
  else if (strchr(s1, '\\'))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<hasdirsep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1140 <hasdirsep+0x30>
movl   $0x1,-0x4(%rbp)
jmp    116b <hasdirsep+0x5b>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1164 <hasdirsep+0x54>
movl   $0x1,-0x4(%rbp)
jmp    116b <hasdirsep+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasdirsep>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     112d <hasdirsep+0x1d>
pop    %rbx
ret
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hasdirsep(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i8* @strchr(i8* %4, i32 47)
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %14
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @strchr(i8* %9, i32 92)
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %2
br label %14
13: ; preds = %8
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @hasdirsep(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 92)
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
long long l_nint(float *);
long long intr_wrap_394(float p1) { return l_nint(&p1); }


x86 assembly (clang, -O0):
<intr_wrap_394>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <l_nint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_394>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <l_nint@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i64 @intr_wrap_394(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call i64 @l_nint(float* %2)
ret i64 %3
}

LLVM IR (-O2):
define i64 @intr_wrap_394(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call i64 @l_nint(float* %2)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void USB_HP_CAN1_TX_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @USB_HP_CAN1_TX_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @USB_HP_CAN1_TX_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_persist_data(void *data) { free(data); }


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

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

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

LLVM IR (-O2):
define void @free_persist_data(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int control_key(int key) { return key >= 1 && key <= 26; }


x86 assembly (clang, -O0):
<control_key>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <control_key+0x20>
cmpl   $0x1a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<control_key>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @control_key(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 26
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @control_key(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
main() {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

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

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
void eapol_sm_notify_config(struct eapol_sm *sm, struct eap_peer_config *config,
                            struct eapol_config *conf) {}


x86 assembly (clang, -O0):
<eapol_sm_notify_config>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.eapol_sm = type opaque
%struct.eap_peer_config = type opaque
%struct.eapol_config = type opaque
define void @eapol_sm_notify_config(%struct.eapol_sm* %0, %struct.eap_peer_config* %1, %struct.eapol_config* %2) {
%4 = alloca %struct.eapol_sm*
%5 = alloca %struct.eap_peer_config*
%6 = alloca %struct.eapol_config*
store %struct.eapol_sm* %0, %struct.eapol_sm** %4
store %struct.eap_peer_config* %1, %struct.eap_peer_config** %5
store %struct.eapol_config* %2, %struct.eapol_config** %6
ret void
}

LLVM IR (-O2):
%struct.eapol_sm = type opaque
%struct.eap_peer_config = type opaque
%struct.eapol_config = type opaque
define void @eapol_sm_notify_config(%struct.eapol_sm* nocapture %0, %struct.eap_peer_config* nocapture %1, %struct.eapol_config* nocapture %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct sol_ptr_vector {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sol_ptr_vector_del(struct sol_ptr_vector *,
                                      int /*<<< orphan*/);
void *sol_ptr_vector_get(struct sol_ptr_vector *, int /*<<< orphan*/);
void *sol_ptr_vector_steal(struct sol_ptr_vector *pv, uint16_t i) {
  void *result = sol_ptr_vector_get(pv, i);
  sol_ptr_vector_del(pv, i);
  return result;
}


x86 assembly (clang, -O0):
<sol_ptr_vector_steal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <sol_ptr_vector_get@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <sol_ptr_vector_del@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sol_ptr_vector_steal>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <sol_ptr_vector_get@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <sol_ptr_vector_del@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.sol_ptr_vector = type { i32 }
define i8* @sol_ptr_vector_steal(%struct.sol_ptr_vector* %0, i32 %1) {
%3 = alloca %struct.sol_ptr_vector*
%4 = alloca i32
%5 = alloca i8*
store %struct.sol_ptr_vector* %0, %struct.sol_ptr_vector** %3
store i32 %1, i32* %4
%6 = load %struct.sol_ptr_vector*, %struct.sol_ptr_vector** %3
%7 = load i32, i32* %4
%8 = call i8* @sol_ptr_vector_get(%struct.sol_ptr_vector* %6, i32 %7)
store i8* %8, i8** %5
%9 = load %struct.sol_ptr_vector*, %struct.sol_ptr_vector** %3
%10 = load i32, i32* %4
%11 = call i32 @sol_ptr_vector_del(%struct.sol_ptr_vector* %9, i32 %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
%struct.sol_ptr_vector = type { i32 }
define i8* @sol_ptr_vector_steal(%struct.sol_ptr_vector* %0, i32 %1) {
%3 = tail call i8* @sol_ptr_vector_get(%struct.sol_ptr_vector* %0, i32 %1)
%4 = tail call i32 @sol_ptr_vector_del(%struct.sol_ptr_vector* %0, i32 %1)
ret i8* %3
}
void __attribute__((always_)) io_wait(void) {
  asm volatile("   jmp 1f\n"
               "1: jmp 2f\n"
               "2:");
}


x86 assembly (clang, -O0):
<io_wait>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <io_wait+0x9>
jmp    110e <io_wait+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_wait>:
jmp    1102 <io_wait+0x2>
jmp    1104 <io_wait+0x4>
ret

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

LLVM IR (-O2):
define void @io_wait() {
tail call void asm sideeffect " jmp 1f\0A1: jmp 2f\0A2:", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int _read_data(int, char *, int, int);
int read_data(int fd, char *buf, int len) {
  return _read_data(fd, buf, len, 5000000);
}


x86 assembly (clang, -O0):
<read_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x4c4b40,%ecx
call   1030 <_read_data@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_data>:
mov    $0x4c4b40,%ecx
jmp    1030 <_read_data@plt>

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

LLVM IR (-O2):
define i32 @read_data(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @_read_data(i32 %0, i8* %1, i32 %2, i32 5000000)
ret i32 %4
}
int safety(card)
short card;
{
  switch (card) {
  case 5:
  case 10:
  case 15:
    return 15;
  case 6:
  case 11:
  case 16:
    return 16;
  case 7:
  case 12:
  case 17:
    return 17;
  case 13:
  case 8:
  case 18:
  case 9:
  case 14:
    return 18;
  }
  return (0);
}


x86 assembly (clang, -O0):
<safety>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
add    $0xfffffffb,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xd,%eax
ja     1165 <safety+0x65>
mov    -0x10(%rbp),%rax
lea    0xed4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xf,-0x4(%rbp)
jmp    116c <safety+0x6c>
movl   $0x10,-0x4(%rbp)
jmp    116c <safety+0x6c>
movl   $0x11,-0x4(%rbp)
jmp    116c <safety+0x6c>
movl   $0x12,-0x4(%rbp)
jmp    116c <safety+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<safety>:
movswl %di,%ecx
add    $0xfffffffb,%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
ja     111a <safety+0x1a>
movslq %ecx,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @safety(i32 %0) {
%2 = alloca i32
%3 = alloca i16
%4 = trunc i32 %0 to i16
store i16 %4, i16* %3
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
switch i32 %6, label %11 [
i32 5, label %7
i32 10, label %7
i32 15, label %7
i32 6, label %8
i32 11, label %8
i32 16, label %8
i32 7, label %9
i32 12, label %9
i32 17, label %9
i32 13, label %10
i32 8, label %10
i32 18, label %10
i32 9, label %10
i32 14, label %10
]
7: ; preds = %1, %1, %1
store i32 15, i32* %2
br label %12
8: ; preds = %1, %1, %1
store i32 16, i32* %2
br label %12
9: ; preds = %1, %1, %1
store i32 17, i32* %2
br label %12
10: ; preds = %1, %1, %1, %1, %1
store i32 18, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@switch.table.safety = [14 x i32] [i32 15, i32 16, i32 17, i32 18, i32 18, i32 15, i32 16, i32 17, i32 18, i32 18, i32 15, i32 16, i32 17, i32 18]
define i32 @safety(i32 %0) {
%2 = shl i32 %0, 16
%3 = ashr exact i32 %2, 16
%4 = add nsw i32 %3, -5
%5 = icmp ult i32 %4, 14
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds [14 x i32], [14 x i32]* @switch.table.safety, i64 0, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
void av_expr_eval() {}


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

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

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

LLVM IR (-O2):
define void @av_expr_eval() {
ret void
}
int maxVectorBytes(void) { return 16; }


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

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

LLVM IR (-O0):
define i32 @maxVectorBytes() {
ret i32 16
}

LLVM IR (-O2):
define i32 @maxVectorBytes() {
ret i32 16
}
/* Variables and functions */
int /*<<< orphan*/ canvas_start_dsp();
void canvas_resume_dsp(int oldstate) {
  if (oldstate)
    canvas_start_dsp();
}


x86 assembly (clang, -O0):
<canvas_resume_dsp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112c <canvas_resume_dsp+0x1c>
mov    $0x0,%al
call   1030 <canvas_start_dsp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canvas_resume_dsp>:
test   %edi,%edi
je     111b <canvas_resume_dsp+0xb>
xor    %eax,%eax
jmp    1030 <canvas_start_dsp@plt>
ret

LLVM IR (-O0):
define void @canvas_resume_dsp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @canvas_start_dsp()
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @canvas_resume_dsp(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @canvas_start_dsp()
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ getc(int /*<<< orphan*/ *);
uint16_t readLittleShort(FILE *file) {
  uint16_t c1 = (uint16_t)getc(file);
  uint16_t c2 = (uint16_t)getc(file) << 8;
  return (uint16_t)(c1 | c2);
}


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

x86 assembly (clang, -O2):
<readLittleShort>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <getc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <getc@plt>
shl    $0x8,%eax
or     %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @readLittleShort(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i64 @getc(i32* %5)
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
%8 = load i32*, i32** %2
%9 = call i64 @getc(i32* %8)
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 8
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = or i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @readLittleShort(i32* nocapture %0) {
%2 = tail call i64 @getc(i32* %0)
%3 = trunc i64 %2 to i32
%4 = tail call i64 @getc(i32* %0)
%5 = trunc i64 %4 to i32
%6 = shl i32 %5, 8
%7 = or i32 %6, %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("xixi");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"xixi\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"xixi\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ last_step_scan(int *, int *, int *);
int /*<<< orphan*/ local_scan(int *);
int /*<<< orphan*/ sum_scan(int *, int *);
void pp_scan(int bucket[16 * 2048 / 16], int bucket2[16 * 2048 / 16],
             int sum[2048 / 16]) {
  local_scan(bucket);
  sum_scan(sum, bucket);
  last_step_scan(bucket, bucket2, sum);
}


x86 assembly (clang, -O0):
<pp_scan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <local_scan@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <sum_scan@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <last_step_scan@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pp_scan>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <local_scan@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <sum_scan@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <last_step_scan@plt>

LLVM IR (-O0):
define void @pp_scan(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** %4
%8 = call i32 @local_scan(i32* %7)
%9 = load i32*, i32** %6
%10 = load i32*, i32** %4
%11 = call i32 @sum_scan(i32* %9, i32* %10)
%12 = load i32*, i32** %4
%13 = load i32*, i32** %5
%14 = load i32*, i32** %6
%15 = call i32 @last_step_scan(i32* %12, i32* %13, i32* %14)
ret void
}

LLVM IR (-O2):
define void @pp_scan(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @local_scan(i32* %0)
%5 = tail call i32 @sum_scan(i32* %2, i32* %0)
%6 = tail call i32 @last_step_scan(i32* %0, i32* %1, i32* %2)
ret void
}
void ndz_rangemap_dumpstats(struct ndz_rangemap *map) {}


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

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

LLVM IR (-O0):
%struct.ndz_rangemap = type opaque
define void @ndz_rangemap_dumpstats(%struct.ndz_rangemap* %0) {
%2 = alloca %struct.ndz_rangemap*
store %struct.ndz_rangemap* %0, %struct.ndz_rangemap** %2
ret void
}

LLVM IR (-O2):
%struct.ndz_rangemap = type opaque
define void @ndz_rangemap_dumpstats(%struct.ndz_rangemap* nocapture %0) {
ret void
}
int ppcharlen(char *const ppchar[]) {
  int i = -1;
  while (ppchar[++i])
    ;
  return i;
}


x86 assembly (clang, -O0):
<ppcharlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     112f <ppcharlen+0x2f>
jmp    110f <ppcharlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ppcharlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <ppcharlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @ppcharlen(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ -1, %1 ]
%4 = add nsw i64 %3, 1
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %4 to i32
ret i32 %9
}
int getfirst(int arr[]) { return *(arr + 1); }


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

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

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

LLVM IR (-O2):
define i32 @getfirst(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int, char *, int);
int getpid();
int /*<<< orphan*/ texit(int);
int do_texit() {
  int pid = getpid();
  fprintf(2, "thread %d texit()\n", pid);
  texit(pid);
}


x86 assembly (clang, -O0):
<do_texit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x2,%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%edi
call   1050 <texit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_texit>:
push   %rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
lea    0xebf(%rip),%rsi
mov    $0x2,%edi
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <texit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"thread %d texit()\0A\00"
define i32 @do_texit() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getpid()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @fprintf(i32 2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @texit(i32 %6)
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [19 x i8] c"thread %d texit()\0A\00"
define i32 @do_texit() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @fprintf(i32 2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @texit(i32 %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
gen_complement() { gen_call("cccom"); }


x86 assembly (clang, -O0):
<gen_complement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <gen_call@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_complement>:
lea    0xee9(%rip),%rdi
jmp    1030 <gen_call@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"cccom\00"
define i32 @gen_complement() {
%1 = alloca i32
%2 = call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [6 x i8] c"cccom\00"
define i32 @gen_complement() {
%1 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void packet_unpack_exit_req(const char *packet) { int len = (4 + 2); }


x86 assembly (clang, -O0):
<packet_unpack_exit_req>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @packet_unpack_exit_req(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int foo(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) { printf("%d\n", foo(0)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1040 <foo@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <foo@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @foo(i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
void ok_while(int x) {
  int n = 100 / x;
  while (x != 0) {
    x--;
  }
}


x86 assembly (clang, -O0):
<ok_while>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x64,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112b <ok_while+0x2b>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1113 <ok_while+0x13>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @ok_while(i32 %0) {
ret void
}
int IRingBuffer_at(int *array, unsigned int row, unsigned int col,
                   unsigned int width) {
  return array[row * width + col];
}


x86 assembly (clang, -O0):
<IRingBuffer_at>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x10(%rbp),%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IRingBuffer_at>:
imul   %ecx,%esi
add    %edx,%esi
mov    (%rdi,%rsi,4),%eax
ret

LLVM IR (-O0):
define i32 @IRingBuffer_at(i32* %0, i32 %1, i32 %2, i32 %3) {
%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 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = mul i32 %10, %11
%13 = load i32, i32* %7
%14 = add i32 %12, %13
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %9, i64 %15
%17 = load i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @IRingBuffer_at(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = mul i32 %3, %1
%6 = add i32 %5, %2
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void process_data(char ch) { putchar(ch); }


x86 assembly (clang, -O0):
<process_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @process_data(i8 signext %0) {
%2 = tail call i32 @putchar(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SYS_getcpu;
int syscall(int /*<<< orphan*/, unsigned int *, unsigned int *, void *);
int getcpu_syscall_wrapper(unsigned *cpu, unsigned *node, void *tcache) {
  return syscall(SYS_getcpu, cpu, node, tcache);
}


x86 assembly (clang, -O0):
<getcpu_syscall_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcpu_syscall_wrapper>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@SYS_getcpu = global i32 0
define i32 @getcpu_syscall_wrapper(i32* %0, i32* %1, i8* %2) {
%4 = load i32, i32* @SYS_getcpu
%5 = tail call i32 @syscall(i32 %4, i32* %0, i32* %1, i8* %2)
ret i32 %5
}