xunge/DecIR huggingface dataset:
const char *base_name(const char *pathname) {
  const char *base, *pch;
  char ch;
  for (pch = base = pathname; (ch = *pch++) != '\0';)
    if (ch == '/')
      base = pch;
  return base;
}


x86 assembly (clang, -O0):
<base_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     114e <base_name+0x4e>
movsbl -0x19(%rbp),%eax
cmp    $0x2f,%eax
jne    1149 <base_name+0x49>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <base_name+0x14>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_name>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
movzbl (%rcx),%edx
add    $0x1,%rcx
cmp    $0x2f,%dl
je     1122 <base_name+0x22>
test   %dl,%dl
jne    1110 <base_name+0x10>
jmp    1127 <base_name+0x27>
mov    %rcx,%rax
jmp    1110 <base_name+0x10>
ret

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

LLVM IR (-O2):
define i8* @base_name(i8* %0) {
br label %2
2: ; preds = %4, %1
%3 = phi i8* [ %0, %1 ], [ %6, %4 ]
br label %4
4: ; preds = %2, %4
%5 = phi i8* [ %6, %4 ], [ %3, %2 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
switch i8 %7, label %4 [
i8 0, label %8
i8 47, label %2
]
8: ; preds = %4
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ kill_all_monster();
int /*<<< orphan*/ kill_all_task();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ switch_taskflg();
void game_end(void) {
  switch_taskflg();
  kill_all_monster();
  kill_all_task();
  printf("Thank you for playing.\n");
}


x86 assembly (clang, -O0):
<game_end>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <switch_taskflg@plt>
mov    $0x0,%al
call   1060 <kill_all_monster@plt>
mov    $0x0,%al
call   1050 <kill_all_task@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<game_end>:
push   %rax
xor    %eax,%eax
call   1040 <switch_taskflg@plt>
xor    %eax,%eax
call   1060 <kill_all_monster@plt>
xor    %eax,%eax
call   1050 <kill_all_task@plt>
lea    0xea3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Thank you for playing.\0A\00"
define void @game_end() {
%1 = call i32 (...) @switch_taskflg()
%2 = call i32 (...) @kill_all_monster()
%3 = call i32 (...) @kill_all_task()
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"Thank you for playing.\00"
define void @game_end() {
%1 = tail call i32 (...) @switch_taskflg()
%2 = tail call i32 (...) @kill_all_monster()
%3 = tail call i32 (...) @kill_all_task()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ext();
void f() { ext(); }


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

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

LLVM IR (-O0):
define void @f() {
%1 = call i32 (...) @ext()
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = tail call i32 (...) @ext()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int s(int, int, int, int);
int main() {
  if (s(1, 2, 3, 4) != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1040 <s@plt>
cmp    $0x1,%eax
je     1158 <main+0x38>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1040 <s@plt>
cmp    $0x1,%eax
jne    1143 <main+0x23>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @s(i32 1, i32 2, i32 3, i32 4)
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @s(i32 1, i32 2, i32 3, i32 4)
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
int is_attr_on(int var, int attr) {
  if (attr == 0) {
    return var == attr;
  }
  return (((var) & (attr)) == (attr));
}


x86 assembly (clang, -O0):
<is_attr_on>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    112a <is_attr_on+0x2a>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    113e <is_attr_on+0x3e>
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_attr_on>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
not    %edi
xor    %ecx,%ecx
test   %edi,%esi
sete   %cl
test   %esi,%esi
cmovne %ecx,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @is_attr_on(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* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = icmp eq i32 %9, %10
%12 = zext i1 %11 to i32
store i32 %12, i32* %3
br label %20
13: ; preds = %2
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = and i32 %14, %15
%17 = load i32, i32* %5
%18 = icmp eq i32 %16, %17
%19 = zext i1 %18 to i32
store i32 %19, i32* %3
br label %20
20: ; preds = %13, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @is_attr_on(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = icmp eq i32 %0, 0
%5 = and i32 %1, %0
%6 = icmp eq i32 %5, %1
%7 = select i1 %3, i1 %4, i1 %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int CPU_is_bigendian() {
  union {
    float q;
    unsigned char c[4];
  } fone;
  fone.q = 1.0;
  return fone.c[0];
}


x86 assembly (clang, -O0):
<CPU_is_bigendian>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movzbl -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { float }
define i32 @CPU_is_bigendian() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to float*
store float 1.000000e+00, float* %2
%3 = bitcast %union.anon* %1 to [4 x i8]*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @CPU_is_bigendian() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Prt(char *, int, int);
void tp__display_commands() {
  Prt(("You may:"), (21) - 1, (1) - 1);
  Prt((" p) Bid on an item.            <space> browse store's inventory."),
      (22) - 1, (1) - 1);
  Prt((" s) Put an item up for bid.    i) Inventory and Equipment Lists."),
      (23) - 1, (1) - 1);
  Prt(("^R) Redraw the screen.       Esc) Exit from Building."), (24) - 1,
      (1) - 1);
}


x86 assembly (clang, -O0):
<tp__display_commands>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x14,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xedb(%rip),%rdi
mov    $0x15,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf09(%rip),%rdi
mov    $0x16,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf37(%rip),%rdi
mov    $0x17,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tp__display_commands>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x14,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xede(%rip),%rdi
mov    $0x15,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf0c(%rip),%rdi
mov    $0x16,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf3a(%rip),%rdi
mov    $0x17,%esi
xor    %edx,%edx
pop    %rax
jmp    1030 <Prt@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"You may:\00"
@.str.1 = [65 x i8] c" p) Bid on an item. <space> browse store's inventory.\00"
@.str.2 = [65 x i8] c" s) Put an item up for bid. i) Inventory and Equipment Lists.\00"
@.str.3 = [54 x i8] c"^R) Redraw the screen. Esc) Exit from Building.\00"
define void @tp__display_commands() {
%1 = call i32 @Prt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 20, i32 0)
%2 = call i32 @Prt(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i32 21, i32 0)
%3 = call i32 @Prt(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i32 22, i32 0)
%4 = call i32 @Prt(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 23, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"You may:\00"
@.str.1 = [65 x i8] c" p) Bid on an item. <space> browse store's inventory.\00"
@.str.2 = [65 x i8] c" s) Put an item up for bid. i) Inventory and Equipment Lists.\00"
@.str.3 = [54 x i8] c"^R) Redraw the screen. Esc) Exit from Building.\00"
define void @tp__display_commands() {
%1 = tail call i32 @Prt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 20, i32 0)
%2 = tail call i32 @Prt(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i32 21, i32 0)
%3 = tail call i32 @Prt(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i32 22, i32 0)
%4 = tail call i32 @Prt(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 23, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, int /*<<< orphan*/ *);
void post_assignment() { write("json-task.json", "}\n", NULL); }


x86 assembly (clang, -O0):
<post_assignment>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<post_assignment>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
xor    %edx,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"json-task.json\00"
@.str.1 = [3 x i8] c"}\0A\00"
define void @post_assignment() {
%1 = call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"json-task.json\00"
@.str.1 = [3 x i8] c"}\0A\00"
define void @post_assignment() {
%1 = tail call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
reg0adrreg1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if (r0 <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<reg0adrreg1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
mov    -0x30(%rbp),%rax
movsd  0x21e888(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1143 <reg0adrreg1+0x43>
movl   $0x1,-0x4(%rbp)
jmp    114a <reg0adrreg1+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg0adrreg1>:
movsd  0x21e888(%rcx),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setae  %al
ret

LLVM IR (-O0):
define i32 @reg0adrreg1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double, double* %8
%15 = load double*, double** %13
%16 = getelementptr inbounds double, double* %15, i64 277777
%17 = load double, double* %16
%18 = fcmp ole double %14, %17
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 1, i32* %7
br label %21
20: ; preds = %6
store i32 0, i32* %7
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @reg0adrreg1(double %0, double %1, i32 %2, i32 %3, double* nocapture readnone %4, double* nocapture %5) {
%7 = getelementptr inbounds double, double* %5, i64 277777
%8 = load double, double* %7
%9 = fcmp oge double %8, %0
%10 = zext i1 %9 to i32
ret i32 %10
}
unsigned xrop3_48_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = ~S;
  stk1 = T & stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_48_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_48_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_48_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %6
%23 = xor i32 %22, -1
store i32 %23, i32* %9
%24 = load i32, i32* %7
%25 = load i32, i32* %9
%26 = and i32 %24, %25
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = load i32, i32* %6
%29 = xor i32 %28, -1
%30 = and i32 %27, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = and i32 %31, %32
%34 = or i32 %30, %33
ret i32 %34
}

LLVM IR (-O2):
define i32 @xrop3_48_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %4, -1
%8 = and i32 %6, %7
%9 = or i32 %8, %3
ret i32 %9
}
int test_imm_6Duint8_reg(unsigned char val) {
  return ((val) & (-0x6D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Duint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff93,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ trimr(char *);
char *get_name(FILE *in, FILE *out, char const *type) {
  char *s = NULL;
  size_t capp = 0;
  fprintf(out, "%s: ", type);
  getline(&s, &capp, in);
  trimr(s);
  return s;
}


x86 assembly (clang, -O0):
<get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <getline@plt>
mov    -0x20(%rbp),%rdi
call   1050 <trimr@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xead(%rip),%rsi
mov    %rax,%rdi
call   1030 <fprintf@plt>
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rbx,%rdx
call   1040 <getline@plt>
mov    (%rsp),%rdi
call   1050 <trimr@plt>
mov    (%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
define i8* @get_name(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
store i8* null, i8** %7
store i64 0, i64* %8
%9 = load i32*, i32** %5
%10 = load i8*, i8** %6
%11 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32*, i32** %4
%13 = call i32 @getline(i8** %7, i64* %8, i32* %12)
%14 = load i8*, i8** %7
%15 = call i32 @trimr(i8* %14)
%16 = load i8*, i8** %7
ret i8* %16
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
define i8* @get_name(i32* %0, i32* nocapture %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%8 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @getline(i8** %4, i64* %5, i32* %0)
%10 = load i8*, i8** %4
%11 = call i32 @trimr(i8* %10)
%12 = load i8*, i8** %4
ret i8* %12
}
/* Type definitions */
struct timespec {
  double tv_sec;
  double tv_nsec;
};

/* Variables and functions */
double bench_elapsed_s(const struct timespec *start,
                       const struct timespec *end) {
  return ((end->tv_sec - start->tv_sec) +
          ((end->tv_nsec - start->tv_nsec) * 0.000000001));
}


x86 assembly (clang, -O0):
<bench_elapsed_s>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  0xeca(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bench_elapsed_s>:
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm0
subsd  (%rdi),%xmm1
subsd  0x8(%rdi),%xmm0
mulsd  0xee6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { double, double }
define double @bench_elapsed_s(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load %struct.timespec*, %struct.timespec** %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%7 = load double, double* %6
%8 = load %struct.timespec*, %struct.timespec** %3
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = load %struct.timespec*, %struct.timespec** %4
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 1
%14 = load double, double* %13
%15 = load %struct.timespec*, %struct.timespec** %3
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 1
%17 = load double, double* %16
%18 = fsub double %14, %17
%19 = call double @llvm.fmuladd.f64(double %18, double 1.000000e-09, double %11)
ret double %19
}

LLVM IR (-O2):
%struct.timespec = type { double, double }
define double @bench_elapsed_s(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load double, double* %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%11 = load double, double* %10
%12 = fsub double %9, %11
%13 = tail call double @llvm.fmuladd.f64(double %12, double 1.000000e-09, double %7)
ret double %13
}
/* Type definitions */
typedef int /*<<< orphan*/ fenv_t;

/* Variables and functions */
int /*<<< orphan*/ feholdexcept(int /*<<< orphan*/ *);
int /*<<< orphan*/ fesetenv(int /*<<< orphan*/ *);
double rint(double);
double nearbyint(double x) {
  fenv_t fenv;
  double res;
  feholdexcept(&fenv);
  res = rint(x);
  fesetenv(&fenv);
  return (res);
}


x86 assembly (clang, -O0):
<nearbyint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <feholdexcept@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <rint@plt>
movsd  %xmm0,-0x18(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <fesetenv@plt>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nearbyint>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <feholdexcept@plt>
mov    %rbx,%rdi
call   1050 <fesetenv@plt>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1030 <rint@plt>

LLVM IR (-O0):
define double @nearbyint(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store double %0, double* %2
%5 = call i32 @feholdexcept(i32* %3)
%6 = load double, double* %2
%7 = call double @llvm.rint.f64(double %6)
store double %7, double* %4
%8 = call i32 @fesetenv(i32* %3)
%9 = load double, double* %4
ret double %9
}

LLVM IR (-O2):
define double @nearbyint(double %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @feholdexcept(i32* %2)
%5 = call double @llvm.rint.f64(double %0)
%6 = call i32 @fesetenv(i32* %2)
ret double %5
}
/* Variables and functions */
scalar_t__ fabs(double);
double fmina(double x, double y) { return fabs(x) < fabs(y) ? x : y; }


x86 assembly (clang, -O0):
<fmina>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jge    1159 <fmina+0x49>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1163 <fmina+0x53>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmina>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <fabs@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
call   1030 <fabs@plt>
movsd  0x8(%rsp),%xmm0
cmp    %rax,%rbx
jl     1142 <fmina+0x32>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @fmina(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call i64 @fabs(double %5)
%7 = load double, double* %4
%8 = call i64 @fabs(double %7)
%9 = icmp slt i64 %6, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load double, double* %3
br label %14
12: ; preds = %2
%13 = load double, double* %4
br label %14
14: ; preds = %12, %10
%15 = phi double [ %11, %10 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @fmina(double %0, double %1) {
%3 = tail call i64 @fabs(double %0)
%4 = tail call i64 @fabs(double %1)
%5 = icmp slt i64 %3, %4
%6 = select i1 %5, double %0, double %1
ret double %6
}
void init_mp_tomcrypt(void) {}


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

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

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

LLVM IR (-O2):
define void @init_mp_tomcrypt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
char *strupr(char *);
int main(void) {
  char mystring[255];
  scanf("%s", mystring);
  printf("%s\n", strupr(mystring));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <strupr@plt>
mov    %rax,%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xec1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strupr@plt>
lea    0xeaa(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* @strupr(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
unsigned long long udiv64(unsigned long long, unsigned long long);
unsigned long long __udivdi3(unsigned long long n, unsigned long long d) {
  return udiv64(n, d);
}


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

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

LLVM IR (-O0):
define i64 @__udivdi3(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i64 @udiv64(i64 %5, i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @__udivdi3(i64 %0, i64 %1) {
%3 = tail call i64 @udiv64(i64 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ output_line(char *);
void code_segment_gtext(void) { output_line("\t.code"); }


x86 assembly (clang, -O0):
<code_segment_gtext>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <output_line@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"\09.code\00"
define void @code_segment_gtext() {
%1 = call i32 @output_line(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\09.code\00"
define void @code_segment_gtext() {
%1 = tail call i32 @output_line(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
void mls_context_init(struct context *c) {}


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

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

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

LLVM IR (-O2):
%struct.context = type opaque
define void @mls_context_init(%struct.context* nocapture %0) {
ret void
}
int inList(int fd, int pfds[8][2], int nfds) {
  int i;
  for (i = 0; i < nfds; ++i)
    if (pfds[i][1] == fd)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<inList>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1154 <inList+0x54>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%eax
cmp    -0x8(%rbp),%eax
jne    1141 <inList+0x41>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <inList+0x5b>
jmp    1146 <inList+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <inList+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inList>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    111f <inList+0x1f>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edi,0x4(%rsi,%rcx,8)
je     1120 <inList+0x20>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <inList+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @inList(i32 %0, [2 x i32]* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
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 [2 x i32], [2 x i32]* %1, i64 %8, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %0
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 /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ do_error(char *);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int tw_pthread_mutex_unlock(pthread_mutex_t *m) {
  int return_value;
  if ((return_value = pthread_mutex_unlock(m)) == -1)
    do_error("pthread_mutex_unlock");
  return (return_value);
}


x86 assembly (clang, -O0):
<tw_pthread_mutex_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pthread_mutex_unlock@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    114d <tw_pthread_mutex_unlock+0x2d>
lea    0xeb8(%rip),%rdi
call   1040 <do_error@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tw_pthread_mutex_unlock>:
push   %rbx
call   1030 <pthread_mutex_unlock@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1139 <tw_pthread_mutex_unlock+0x19>
lea    0xecc(%rip),%rdi
call   1040 <do_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"pthread_mutex_unlock\00"
define i32 @tw_pthread_mutex_unlock(i32* %0) {
%2 = tail call i32 @pthread_mutex_unlock(i32* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @do_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t len = 0;
  while (str[len]) {
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1133 <strlen+0x33>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int epoll_create(int);
int /*<<< orphan*/ perror(char *);
int newEpollSocket(void) {
  int epollfd = epoll_create(5);
  if (epollfd == -1) {
    perror("can not create epoll socket:");
    return -1;
  }
  return epollfd;
}


x86 assembly (clang, -O0):
<newEpollSocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1040 <epoll_create@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1157 <newEpollSocket+0x37>
lea    0xeba(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <newEpollSocket+0x3d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newEpollSocket>:
push   %rbx
mov    $0x5,%edi
call   1040 <epoll_create@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1136 <newEpollSocket+0x16>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec3(%rip),%rdi
call   1030 <perror@plt>
jmp    1132 <newEpollSocket+0x12>

LLVM IR (-O0):
@.str = [29 x i8] c"can not create epoll socket:\00"
define i32 @newEpollSocket() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @epoll_create(i32 5)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %10
8: ; preds = %0
%9 = load i32, i32* %2
store i32 %9, i32* %1
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [29 x i8] c"can not create epoll socket:\00"
define i32 @newEpollSocket() {
%1 = tail call i32 @epoll_create(i32 5)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
ret i32 %1
}
void ble_rsp_system_reg_read(const struct ble_msg_system_reg_read_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_system_reg_read_rsp_t = type opaque
define void @ble_rsp_system_reg_read(%struct.ble_msg_system_reg_read_rsp_t* nocapture %0) {
ret void
}
int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
                       unsigned nsops, int alter) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.sem_array = type opaque
%struct.sembuf = type opaque
define i32 @security_sem_semop(%struct.sem_array* %0, %struct.sembuf* %1, i32 %2, i32 %3) {
%5 = alloca %struct.sem_array*
%6 = alloca %struct.sembuf*
%7 = alloca i32
%8 = alloca i32
store %struct.sem_array* %0, %struct.sem_array** %5
store %struct.sembuf* %1, %struct.sembuf** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.sem_array = type opaque
%struct.sembuf = type opaque
define i32 @security_sem_semop(%struct.sem_array* nocapture readnone %0, %struct.sembuf* nocapture readnone %1, i32 %2, i32 %3) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
unsigned int countLine(FILE *f) {
  int c;
  unsigned int l = 1;
  while ((c = fgetc(f)) != EOF) {
    if (c == '\n') {
      l++;
    }
  }
  return l;
}


x86 assembly (clang, -O0):
<countLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2eb2(%rip),%rcx
cmp    (%rcx),%eax
je     1156 <countLine+0x46>
cmpl   $0xa,-0xc(%rbp)
jne    1151 <countLine+0x41>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <countLine+0x13>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countLine>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <fgetc@plt>
mov    0x2ec5(%rip),%r14
mov    $0x1,%ebp
cmp    (%r14),%eax
je     1157 <countLine+0x47>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebp
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r14),%eax
jne    1140 <countLine+0x30>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @countLine(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %14, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ %2, %1 ]
%7 = phi i32 [ %10, %5 ], [ 1, %1 ]
%8 = icmp eq i32 %6, 10
%9 = zext i1 %8 to i32
%10 = add i32 %7, %9
%11 = tail call i32 @fgetc(i32* %0)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %5
14: ; preds = %5, %1
%15 = phi i32 [ 1, %1 ], [ %10, %5 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ jx_term_debug();
int main(int argc, const char *argv[]) {
  jx_term_debug();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <jx_term_debug@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @jx_term_debug()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @jx_term_debug()
ret i32 0
}
int digitsum(int n) {
  int r = 0;
  for (; n != 0; n /= 10)
    r += n % 10;
  return r;
}


x86 assembly (clang, -O0):
<digitsum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113c <digitsum+0x3c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <digitsum+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitsum>:
xor    %eax,%eax
test   %edi,%edi
je     113b <digitsum+0x3b>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %esi,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <digitsum+0x10>
ret

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

LLVM IR (-O2):
define i32 @digitsum(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = srem i32 %5, 10
%7 = add nsw i32 %4, %6
%8 = sdiv i32 %5, 10
%9 = add i32 %5, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %12
}
int test_imm_E0int32_mem(int *val) {
  return ((*val) & (0xE0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E0int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 224
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_ADuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xAD << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_ADuint64_highword_mem>:
testb  $0xad,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_ADuint64_highword_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, 32
%6 = and i64 %5, 173
%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_ADuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 743029342208
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int node_map(int cpu_id) { return (cpu_id & 0x1); }


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

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

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

LLVM IR (-O2):
define i32 @node_map(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ _Error(long, char *);
void Error_OpcodeArgumentMustBeLabel(long p_position) {
  _Error(p_position, "Opcode argument must be a label");
}


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

x86 assembly (clang, -O2):
<Error_OpcodeArgumentMustBeLabel>:
lea    0xee9(%rip),%rsi
jmp    1030 <_Error@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Opcode argument must be a label\00"
define void @Error_OpcodeArgumentMustBeLabel(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Error(i64 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Opcode argument must be a label\00"
define void @Error_OpcodeArgumentMustBeLabel(i64 %0) {
%2 = tail call i32 @_Error(i64 %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}