xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int16_t OPL3_ClipSample(int32_t sample) {
  if (sample > 32767) {
    sample = 32767;
  } else if (sample < -32768) {
    sample = -32768;
  }
  return (int16_t)sample;
}


x86 assembly (clang, -O0):
<OPL3_ClipSample>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x7fff,-0x4(%rbp)
jle    1120 <OPL3_ClipSample+0x20>
movl   $0x7fff,-0x4(%rbp)
jmp    1139 <OPL3_ClipSample+0x39>
cmpl   $0xffff8000,-0x4(%rbp)
jge    1134 <OPL3_ClipSample+0x34>
movl   $0xffff8000,-0x4(%rbp)
jmp    1139 <OPL3_ClipSample+0x39>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<OPL3_ClipSample>:
cmp    $0xffff8001,%edi
mov    $0xffff8000,%ecx
cmovge %edi,%ecx
cmp    $0x7fff,%ecx
mov    $0x7fff,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @OPL3_ClipSample(i32 %0) {
%2 = icmp sgt i32 %0, -32768
%3 = select i1 %2, i32 %0, i32 -32768
%4 = icmp slt i32 %3, 32767
%5 = select i1 %4, i32 %3, i32 32767
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *program_name) {
  printf("Usage: %s [filename ..]\n", program_name);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Usage: %s [filename ..]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Usage: %s [filename ..]\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct katcp_dispatch {
  int dummy;
};

/* Variables and functions */
int log_level_generic_katcp(struct katcp_dispatch *, int, int /*<<< orphan*/);
int log_local_cmd_katcp(struct katcp_dispatch *d, int argc) {
  return log_level_generic_katcp(d, argc, 0);
}


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

x86 assembly (clang, -O2):
<log_local_cmd_katcp>:
xor    %edx,%edx
jmp    1030 <log_level_generic_katcp@plt>

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
define i32 @log_local_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = alloca %struct.katcp_dispatch*
%4 = alloca i32
store %struct.katcp_dispatch* %0, %struct.katcp_dispatch** %3
store i32 %1, i32* %4
%5 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %3
%6 = load i32, i32* %4
%7 = call i32 @log_level_generic_katcp(%struct.katcp_dispatch* %5, i32 %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define i32 @log_local_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = tail call i32 @log_level_generic_katcp(%struct.katcp_dispatch* %0, i32 %1, i32 0)
ret i32 %3
}
/* Variables and functions */
char *defangIPaddr(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *a = defangIPaddr("10.10.10.111");
  printf("%s\n", a);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"10.10.10.111\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @defangIPaddr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, 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
}

LLVM IR (-O2):
@.str = [13 x i8] c"10.10.10.111\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* @defangIPaddr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f(void) { printf("Hello world\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
define void @f() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello world\00"
define void @f() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ disp_str(char *);
int /*<<< orphan*/ milli_delay(int);
void test_c() {
  int i = 512;
  while (1) {
    disp_str("C.");
    milli_delay(10);
  }
}


x86 assembly (clang, -O0):
<test_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x200,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <disp_str@plt>
mov    $0xa,%edi
call   1040 <milli_delay@plt>
jmp    112f <test_c+0xf>

x86 assembly (clang, -O2):
<test_c>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <disp_str@plt>
mov    $0xa,%edi
call   1040 <milli_delay@plt>
jmp    1130 <test_c+0x10>

LLVM IR (-O0):
@.str = [3 x i8] c"C.\00"
define void @test_c() {
%1 = alloca i32
store i32 512, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @disp_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @milli_delay(i32 10)
br label %2
}

LLVM IR (-O2):
@.str = [3 x i8] c"C.\00"
define void @test_c() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @disp_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @milli_delay(i32 10)
br label %1
}
int baz(int x, int y) {
  x &= 15;
  y &= 15;
  x += 4;
  y += 16;
  x &= y;
  return x < 20;
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x14,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @baz(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = and i32 %5, 15
store i32 %6, i32* %3
%7 = load i32, i32* %4
%8 = and i32 %7, 15
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 4
store i32 %10, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 16
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = and i32 %14, %13
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 20
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @baz(i32 %0, i32 %1) {
ret i32 1
}
double f4_sum_int_post_double(int v, double v0) { return v0 + ((double)(v)); }


x86 assembly (clang, -O0):
<f4_sum_int_post_double>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_sum_int_post_double>:
cvtsi2sd %edi,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4_sum_int_post_double(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to double
%8 = fadd double %5, %7
ret double %8
}

LLVM IR (-O2):
define double @f4_sum_int_post_double(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = fadd double %3, %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ Term_erase(int /*<<< orphan*/, int, int);
void clear_question(void) {
  int i;
  for (i = 7; i < 10; i++) {
    Term_erase(0, i, 255);
  }
}


x86 assembly (clang, -O0):
<clear_question>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1146 <clear_question+0x36>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
mov    $0xff,%edx
call   1030 <Term_erase@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <clear_question+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_question>:
push   %rax
xor    %edi,%edi
mov    $0x7,%esi
mov    $0xff,%edx
call   1030 <Term_erase@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    $0xff,%edx
call   1030 <Term_erase@plt>
xor    %edi,%edi
mov    $0x9,%esi
mov    $0xff,%edx
pop    %rax
jmp    1030 <Term_erase@plt>

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

LLVM IR (-O2):
define void @clear_question() {
%1 = tail call i32 @Term_erase(i32 0, i32 7, i32 255)
%2 = tail call i32 @Term_erase(i32 0, i32 8, i32 255)
%3 = tail call i32 @Term_erase(i32 0, i32 9, i32 255)
ret void
}
/* Variables and functions */
double sin(double);
double sind_(double x) { return sin(x); }


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

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

LLVM IR (-O0):
define double @sind_(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @sin(double %3)
ret double %4
}

LLVM IR (-O2):
define double @sind_(double %0) {
%2 = tail call double @sin(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ mill_yield(char *);
void worker(long count) {
  long i;
  for (i = 0; i != count; ++i)
    mill_yield("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/acornejo/libmill/refs/heads/"
               "master/perf/ctxswitch.c"
               ":"
               "43");
}


x86 assembly (clang, -O0):
<worker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     114f <worker+0x3f>
lea    0xec7(%rip),%rdi
call   1030 <mill_yield@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <worker+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<worker>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     113e <worker+0x2e>
mov    %rdi,%rbx
lea    0xedd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <mill_yield@plt>
add    $0xffffffffffffffff,%rbx
jne    1130 <worker+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/acornejo/libmill/refs/heads/master/perf/ctxswitch.c:43\00"
define void @worker(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %3
br label %4
4: ; preds = %10, %1
%5 = load i64, i64* %3
%6 = load i64, i64* %2
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @mill_yield(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8
%11 = load i64, i64* %3
%12 = add nsw i64 %11, 1
store i64 %12, i64* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/acornejo/libmill/refs/heads/master/perf/ctxswitch.c:43\00"
define void @worker(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @mill_yield(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0))
%6 = add nuw nsw i64 %4, 1
%7 = icmp eq i64 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fbClear();
int /*<<< orphan*/ fbMoveCursor(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fbPutString(char *);
void ShowErrorMessage(char *errorType, char *message) {
  fbClear();
  fbMoveCursor(0, 0);
  fbPutString(errorType);
  fbPutString(" : ");
  fbPutString(message);
}


x86 assembly (clang, -O0):
<ShowErrorMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <fbClear@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <fbMoveCursor@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fbPutString@plt>
lea    0xea0(%rip),%rdi
call   1040 <fbPutString@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fbPutString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowErrorMessage>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <fbClear@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <fbMoveCursor@plt>
mov    %rbx,%rdi
call   1040 <fbPutString@plt>
lea    0xea7(%rip),%rdi
call   1040 <fbPutString@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fbPutString@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" : \00"
define void @ShowErrorMessage(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @fbClear()
%6 = call i32 @fbMoveCursor(i32 0, i32 0)
%7 = load i8*, i8** %3
%8 = call i32 @fbPutString(i8* %7)
%9 = call i32 @fbPutString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %4
%11 = call i32 @fbPutString(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" : \00"
define void @ShowErrorMessage(i8* %0, i8* %1) {
%3 = tail call i32 (...) @fbClear()
%4 = tail call i32 @fbMoveCursor(i32 0, i32 0)
%5 = tail call i32 @fbPutString(i8* %0)
%6 = tail call i32 @fbPutString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @fbPutString(i8* %1)
ret void
}
int test_imm_08int16_reg(short val) {
  return ((val) & (-0x08 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_08int16_reg>:
cmp    $0x8,%di
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_08int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -8
%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_08int16_reg(i16 signext %0) {
%2 = icmp ult i16 %0, 8
%3 = select i1 %2, i32 -40, i32 -20
ret i32 %3
}
void _printf(char *_s_, ...) { ; }


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

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

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

LLVM IR (-O2):
define void @_printf(i8* nocapture %0, ...) {
ret void
}
int test6(int x) { return x / -10 == -2; }


x86 assembly (clang, -O0):
<test6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xfffffff6,%ecx
cltd
idiv   %ecx
cmp    $0xfffffffe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test6>:
add    $0xffffffec,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @test6(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, -10
%5 = icmp eq i32 %4, -2
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test6(i32 %0) {
%2 = add i32 %0, -20
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ drop_connection();
int do_disconnect(void) {
  drop_connection();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @do_disconnect() {
%1 = tail call i32 (...) @drop_connection()
ret i32 0
}
void updateSpeed() {}


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

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

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

LLVM IR (-O2):
define void @updateSpeed() {
ret void
}
float DBtoMMFineMode(float db) {
  float maxVal = 30;
  float minVal = -90;
  float mm;
  mm = (db - minVal) * 100 / (maxVal - minVal);
  return mm;
}


x86 assembly (clang, -O0):
<DBtoMMFineMode>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xee6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  0xecb(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DBtoMMFineMode>:
addss  0xef8(%rip),%xmm0
mulss  0xef4(%rip),%xmm0
divss  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define float @DBtoMMFineMode(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %2
store float 3.000000e+01, float* %3
store float -9.000000e+01, float* %4
%6 = load float, float* %2
%7 = load float, float* %4
%8 = fsub float %6, %7
%9 = fmul float %8, 1.000000e+02
%10 = load float, float* %3
%11 = load float, float* %4
%12 = fsub float %10, %11
%13 = fdiv float %9, %12
store float %13, float* %5
%14 = load float, float* %5
ret float %14
}

LLVM IR (-O2):
define float @DBtoMMFineMode(float %0) {
%2 = fadd float %0, 9.000000e+01
%3 = fmul float %2, 1.000000e+02
%4 = fdiv float %3, 1.200000e+02
ret float %4
}
__attribute__((always_)) float brotli_max_float(float a, float b) {
  return a > b ? a : b;
}


x86 assembly (clang, -O0):
<brotli_max_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112c <brotli_max_float+0x2c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1136 <brotli_max_float+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<brotli_max_float>:
maxss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @brotli_max_float(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
scalar_t__ estbisextile(int);
int nbjoursmois(int mois, int annee) {
  int joursparmois[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  if (estbisextile(annee) && (mois == 2)) {
    return 29;
  } else {
    return joursparmois[mois - 1];
  }
}


x86 assembly (clang, -O0):
<nbjoursmois>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%edi
call   1030 <estbisextile@plt>
cmp    $0x0,%rax
je     116b <nbjoursmois+0x4b>
cmpl   $0x2,-0x8(%rbp)
jne    116b <nbjoursmois+0x4b>
movl   $0x1d,-0x4(%rbp)
jmp    117a <nbjoursmois+0x5a>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbjoursmois>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <estbisextile@plt>
cmp    $0x2,%ebx
jne    112e <nbjoursmois+0x1e>
mov    %rax,%rcx
mov    $0x1d,%eax
test   %rcx,%rcx
je     112e <nbjoursmois+0x1e>
pop    %rbx
ret
movslq %ebx,%rax
lea    0xec8(%rip),%rcx
mov    -0x4(%rcx,%rax,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.nbjoursmois.joursparmois = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @nbjoursmois(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [12 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = bitcast [12 x i32]* %6 to i8*
%8 = load i32, i32* %5
%9 = call i64 @estbisextile(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 29, i32* %3
br label %21
15: ; preds = %11, %2
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 %18
%20 = load i32, i32* %19
store i32 %20, i32* %3
br label %21
21: ; preds = %15, %14
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@__const.nbjoursmois.joursparmois = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @nbjoursmois(i32 %0, i32 %1) {
%3 = tail call i64 @estbisextile(i32 %1)
%4 = icmp ne i64 %3, 0
%5 = icmp eq i32 %0, 2
%6 = and i1 %5, %4
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = add nsw i32 %0, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.nbjoursmois.joursparmois, i64 0, i64 %9
%11 = load i32, i32* %10
br label %12
12: ; preds = %2, %7
%13 = phi i32 [ %11, %7 ], [ 29, %2 ]
ret i32 %13
}
unsigned int bitClear(unsigned int value, unsigned int bit) {
  return ((value) &= ~(1UL << (bit)));
}


x86 assembly (clang, -O0):
<bitClear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x4(%rbp),%eax
and    %rcx,%rax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitClear>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%rax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @bitClear(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 = zext i32 %5 to i64
%7 = shl i64 1, %6
%8 = xor i64 %7, -1
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = and i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @bitClear(i32 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = shl nuw i64 1, %3
%5 = trunc i64 %4 to i32
%6 = xor i32 %5, -1
%7 = and i32 %6, %0
ret i32 %7
}
void test_where_to_parameter_dictionary() {}


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

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

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

LLVM IR (-O2):
define void @test_where_to_parameter_dictionary() {
ret void
}
int fun1(int a, int b, int c, int d, int e, int f, int g) {
  int j = 0;
  volatile char x[50];
  &x;
  while (j < 2) {
    a++;
    j++;
  }
  return a;
}


x86 assembly (clang, -O0):
<fun1>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1143 <fun1+0x43>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1122 <fun1+0x22>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fun1(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = add i32 %0, 2
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x2e() {
  Assert_real((isgraph(46)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              235, ("isgraph should be 1 for ."));
}


x86 assembly (clang, -O0):
<t_isgraph_0x2e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2e,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0xeb,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x2e>:
push   %rax
mov    $0x2e,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0xeb,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for .\00"
define void @t_isgraph_0x2e() {
%1 = call i32 @isgraph(i32 46)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 235, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for .\00"
define void @t_isgraph_0x2e() {
%1 = tail call i32 @isgraph(i32 46)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 235, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int pigpio_command(int, int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int clear_bank_2(int pi, uint32_t levels) {
  return pigpio_command(pi, 13, levels, 0, 1);
}


x86 assembly (clang, -O0):
<clear_bank_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0xd,%esi
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <pigpio_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bank_2>:
mov    %esi,%edx
mov    $0xd,%esi
xor    %ecx,%ecx
mov    $0x1,%r8d
jmp    1030 <pigpio_command@plt>

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

LLVM IR (-O2):
define i32 @clear_bank_2(i32 %0, i32 %1) {
%3 = tail call i32 @pigpio_command(i32 %0, i32 13, i32 %1, i32 0, i32 1)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ fork();
int /*<<< orphan*/ sleep(int);
int main(int args, char **argv) {
  pid_t pid = fork();
  if (pid < 0)
    return EXIT_FAILURE;
  if (pid == 0)
    sleep(1);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <fork@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    115d <main+0x3d>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117e <main+0x5e>
cmpq   $0x0,-0x18(%rbp)
jne    1172 <main+0x52>
mov    $0x1,%edi
call   1030 <sleep@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
js     1142 <main+0x22>
mov    0x2ea4(%rip),%rbx
jne    1149 <main+0x29>
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    1149 <main+0x29>
mov    0x2e97(%rip),%rbx
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 (...) @fork()
store i64 %7, i64* %6
%8 = load i64, i64* %6
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %3
br label %19
12: ; preds = %2
%13 = load i64, i64* %6
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @sleep(i32 1)
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* @EXIT_SUCCESS
store i32 %18, i32* %3
br label %19
19: ; preds = %17, %10
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @fork()
%4 = icmp slt i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = icmp eq i64 %3, 0
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @sleep(i32 1)
br label %9
9: ; preds = %5, %7, %2
%10 = phi i32* [ @EXIT_FAILURE, %2 ], [ @EXIT_SUCCESS, %7 ], [ @EXIT_SUCCESS, %5 ]
%11 = load i32, i32* %10
ret i32 %11
}
/* Variables and functions */
int func();
int main(int argc, char **argv) { return func(); }


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 <func@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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 (...) @func()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func()
ret i32 %3
}
int longueur(char *mot) {
  int longmot = 0;
  int i;
  for (i = 0; (mot[i] != 0); i = i + 1) {
    longmot = longmot + 1;
  }
  return (longmot);
}


x86 assembly (clang, -O0):
<longueur>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1142 <longueur+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <longueur+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<longueur>:
cmpb   $0x0,(%rdi)
je     111c <longueur+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <longueur+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @longueur(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %1
%13 = phi i32 [ 0, %1 ], [ %11, %10 ]
ret i32 %13
}
void out_of_memory(void) { return; }


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

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

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

LLVM IR (-O2):
define void @out_of_memory() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(int);
main() {
  f(100);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x64,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 100)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 100)
%2 = tail call i32 @exit(i32 0)
unreachable
}
f(int a, int b) {
  int printf(char *, ...) __attribute((format(printf, 1, 2)));
  printf(a ? "b=%d (a=%s)\n" : "b=%d\n", b, a);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
lea    0xee5(%rip),%rdi
lea    0xed1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %edi,%edx
test   %edi,%edi
lea    0xef2(%rip),%rax
lea    0xede(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"b=%d (a=%s)\0A\00"
@.str.1 = [6 x i8] c"b=%d\0A\00"
define i32 @f(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 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* %9, i32 %10, i32 %11)
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [13 x i8] c"b=%d (a=%s)\0A\00"
@.str.1 = [6 x i8] c"b=%d\0A\00"
define i32 @f(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %4, i32 %1, i32 %0)
ret i32 undef
}
int return4() { return 4; }


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

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

LLVM IR (-O0):
define i32 @return4() {
ret i32 4
}

LLVM IR (-O2):
define i32 @return4() {
ret i32 4
}
/* Type definitions */
typedef union wait {
  int dummy;
} wait;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ __wait4(int /*<<< orphan*/, union wait *, int,
                           int /*<<< orphan*/ *);
pid_t __libc_waitpid(pid_t pid, int *stat_loc, int options) {
  return __wait4(pid, (union wait *)stat_loc, options, NULL);
}


x86 assembly (clang, -O0):
<__libc_waitpid>:
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
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <__wait4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_waitpid>:
xor    %ecx,%ecx
jmp    1030 <__wait4@plt>

LLVM IR (-O0):
%union.wait = type { i32 }
define i32 @__libc_waitpid(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 = load i32*, i32** %5
%9 = bitcast i32* %8 to %union.wait*
%10 = load i32, i32* %6
%11 = call i32 @__wait4(i32 %7, %union.wait* %9, i32 %10, i32* null)
ret i32 %11
}

LLVM IR (-O2):
%union.wait = type { i32 }
define i32 @__libc_waitpid(i32 %0, i32* %1, i32 %2) {
%4 = bitcast i32* %1 to %union.wait*
%5 = tail call i32 @__wait4(i32 %0, %union.wait* %4, i32 %2, i32* null)
ret i32 %5
}
/* Variables and functions */
__attribute__((visibility("default"))) size_t strlen(const char *str) {
  size_t ret = 0;
  while (str[ret] != 0)
    ret++;
  return ret;
}


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
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <strlen+0x36>
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 = %11, %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 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i64, i64* %3
%13 = add i64 %12, 1
store i64 %13, i64* %3
br label %4
14: ; preds = %4
%15 = load i64, i64* %3
ret i64 %15
}

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
}
/* Type definitions */
struct per_cpu_info {
  int dummy;
};
struct blk_io_trace {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ process_fmt(char *, struct per_cpu_info *,
                               struct blk_io_trace *, unsigned long long,
                               int /*<<< orphan*/, int /*<<< orphan*/ *);
void log_split(struct per_cpu_info *pci, struct blk_io_trace *t, char *act) {
  process_fmt(act, pci, t, -1ULL, 0, NULL);
}


x86 assembly (clang, -O0):
<log_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0xffffffffffffffff,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%r9d
call   1030 <process_fmt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_split>:
mov    %rdx,%rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rax,%rdi
mov    $0xffffffffffffffff,%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <process_fmt@plt>

LLVM IR (-O0):
%struct.per_cpu_info = type { i32 }
%struct.blk_io_trace = type { i32 }
define void @log_split(%struct.per_cpu_info* %0, %struct.blk_io_trace* %1, i8* %2) {
%4 = alloca %struct.per_cpu_info*
%5 = alloca %struct.blk_io_trace*
%6 = alloca i8*
store %struct.per_cpu_info* %0, %struct.per_cpu_info** %4
store %struct.blk_io_trace* %1, %struct.blk_io_trace** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = load %struct.per_cpu_info*, %struct.per_cpu_info** %4
%9 = load %struct.blk_io_trace*, %struct.blk_io_trace** %5
%10 = call i32 @process_fmt(i8* %7, %struct.per_cpu_info* %8, %struct.blk_io_trace* %9, i64 -1, i32 0, i32* null)
ret void
}

LLVM IR (-O2):
%struct.per_cpu_info = type { i32 }
%struct.blk_io_trace = type { i32 }
define void @log_split(%struct.per_cpu_info* %0, %struct.blk_io_trace* %1, i8* %2) {
%4 = tail call i32 @process_fmt(i8* %2, %struct.per_cpu_info* %0, %struct.blk_io_trace* %1, i64 -1, i32 0, i32* null)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int celcon_read_mixed_cell_configuration(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(80, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_read_mixed_cell_configuration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x50,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_read_mixed_cell_configuration>:
mov    $0x50,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @celcon_read_mixed_cell_configuration() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 80, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @celcon_read_mixed_cell_configuration() {
%1 = tail call i32 @_ada_use_c2phc(i32 80, i32* undef, i32* undef, double* undef)
ret i32 %1
}
int getlong(unsigned char *buffer, int offset) {
  return (long)buffer[offset] | ((long)buffer[offset + 1] << 8L) |
         ((long)buffer[offset + 2] << 16L) | ((long)buffer[offset + 3] << 24L);
}


x86 assembly (clang, -O0):
<getlong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x18,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getlong>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%eax
ret

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

LLVM IR (-O2):
define i32 @getlong(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = add nsw i32 %1, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 8
%13 = or i32 %12, %6
%14 = add nsw i32 %1, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl nuw nsw i32 %18, 16
%20 = or i32 %13, %19
%21 = add nsw i32 %1, 3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = shl nuw i32 %25, 24
%27 = or i32 %20, %26
ret i32 %27
}
char test_char_6(char a, char b, char c, char d, char e, char f) { return 'c'; }


x86 assembly (clang, -O0):
<test_char_6>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x18(%rbp)
mov    %ecx,%eax
mov    -0x18(%rbp),%ecx
mov    %eax,-0x14(%rbp)
mov    %edx,%eax
mov    -0x14(%rbp),%edx
mov    %eax,-0x10(%rbp)
mov    %esi,%eax
mov    -0x10(%rbp),%esi
mov    %eax,-0xc(%rbp)
mov    %edi,%r8d
mov    -0xc(%rbp),%edi
mov    %r9b,%al
mov    %r8b,-0x1(%rbp)
mov    %dil,-0x2(%rbp)
mov    %sil,-0x3(%rbp)
mov    %dl,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    $0x63,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_char_6>:
mov    $0x63,%al
ret

LLVM IR (-O0):
define signext i8 @test_char_6(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5) {
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
store i8 %0, i8* %7
store i8 %1, i8* %8
store i8 %2, i8* %9
store i8 %3, i8* %10
store i8 %4, i8* %11
store i8 %5, i8* %12
ret i8 99
}

LLVM IR (-O2):
define signext i8 @test_char_6(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5) {
ret i8 99
}