xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ activity_main_get_context();
int /*<<< orphan*/ activity_manager_start_activity(int /*<<< orphan*/);
int /*<<< orphan*/ service_fona_hang_up();
void cancel_call_for_help_menu_item_selection_handler_in_main_loop() {
  service_fona_hang_up();
  activity_manager_start_activity(activity_main_get_context());
}


x86 assembly (clang, -O0):
<cancel_call_for_help_menu_item_selection_handler_in_main_loop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <service_fona_hang_up@plt>
mov    $0x0,%al
call   1030 <activity_main_get_context@plt>
mov    %eax,%edi
call   1040 <activity_manager_start_activity@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cancel_call_for_help_menu_item_selection_handler_in_main_loop>:
push   %rax
xor    %eax,%eax
call   1050 <service_fona_hang_up@plt>
xor    %eax,%eax
call   1030 <activity_main_get_context@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <activity_manager_start_activity@plt>

LLVM IR (-O0):
define void @cancel_call_for_help_menu_item_selection_handler_in_main_loop() {
%1 = call i32 (...) @service_fona_hang_up()
%2 = call i32 (...) @activity_main_get_context()
%3 = call i32 @activity_manager_start_activity(i32 %2)
ret void
}

LLVM IR (-O2):
define void @cancel_call_for_help_menu_item_selection_handler_in_main_loop() {
%1 = tail call i32 (...) @service_fona_hang_up()
%2 = tail call i32 (...) @activity_main_get_context()
%3 = tail call i32 @activity_manager_start_activity(i32 %2)
ret void
}
void XDrawText() {}


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

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

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

LLVM IR (-O2):
define void @XDrawText() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void *memset(void *restrict ptr, int value, size_t num) {
  uint8_t *real_ptr = (uint8_t *)ptr;
  uint8_t real_value = (uint8_t)value;
  for (size_t i = 0; i < num; ++i) {
    *real_ptr = real_value;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114d <memset+0x4d>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1125 <memset+0x25>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset>:
mov    %rdi,%rax
test   %rdx,%rdx
je     110a <memset+0xa>
mov    %esi,(%rax)
ret

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

LLVM IR (-O2):
define i8* @memset(i8* noalias returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = bitcast i8* %0 to i32*
store i32 %1, i32* %6
br label %7
7: ; preds = %5, %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ f();
int main(void) {
  int b;
  while (!(b == 0)) {
    f();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
xor    $0xff,%al
test   $0x1,%al
jne    1135 <main+0x25>
jmp    1141 <main+0x31>
mov    $0x0,%al
call   1030 <f@plt>
jmp    111f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 (...) @f()
br label %3
9: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ characterValueOf(int);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int primitiveTranscriptClass_NextPut_(int receiver, int *arguments) {
  putchar(characterValueOf(arguments[0]));
  return arguments[0];
}


x86 assembly (clang, -O0):
<primitiveTranscriptClass_NextPut_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <characterValueOf@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitiveTranscriptClass_NextPut_>:
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%edi
call   1040 <characterValueOf@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @primitiveTranscriptClass_NextPut_(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 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = call i32 @characterValueOf(i32 %7)
%9 = call i32 @putchar(i32 %8)
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @primitiveTranscriptClass_NextPut_(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @characterValueOf(i32 %3)
%5 = tail call i32 @putchar(i32 %4)
%6 = load i32, i32* %1
ret i32 %6
}
int emac1_ifoutucastpkts_set(unsigned int dev_id,
                             union emac1_ifoutucastpkts_u *value) {
  return 1;
}


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

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

LLVM IR (-O0):
%union.emac1_ifoutucastpkts_u = type opaque
define i32 @emac1_ifoutucastpkts_set(i32 %0, %union.emac1_ifoutucastpkts_u* %1) {
%3 = alloca i32
%4 = alloca %union.emac1_ifoutucastpkts_u*
store i32 %0, i32* %3
store %union.emac1_ifoutucastpkts_u* %1, %union.emac1_ifoutucastpkts_u** %4
ret i32 1
}

LLVM IR (-O2):
%union.emac1_ifoutucastpkts_u = type opaque
define i32 @emac1_ifoutucastpkts_set(i32 %0, %union.emac1_ifoutucastpkts_u* nocapture readnone %1) {
ret i32 1
}
unsigned __attribute__((visibility("hidden"))) gz_intmax() {
  unsigned p, q;
  p = 1;
  do {
    q = p;
    p <<= 1;
    p++;
  } while (p > q);
  return q >> 1;
}


x86 assembly (clang, -O0):
<gz_intmax>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     110b <gz_intmax+0xb>
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define hidden i32 @gz_intmax() {
ret i32 2147483647
}
/* Variables and functions */
int /*<<< orphan*/ OPLinkReceiverHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void OPLinkReceiverRequestUpdate() {
  UAVObjRequestUpdate(OPLinkReceiverHandle());
}


x86 assembly (clang, -O0):
<OPLinkReceiverRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <OPLinkReceiverHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OPLinkReceiverRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <OPLinkReceiverHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @OPLinkReceiverRequestUpdate() {
%1 = call i32 (...) @OPLinkReceiverHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @OPLinkReceiverRequestUpdate() {
%1 = tail call i32 (...) @OPLinkReceiverHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *, int);
int /*<<< orphan*/ vga_test();
void int_16(void) {
  vga_test();
  print("inter 0x10 called", 10);
}


x86 assembly (clang, -O0):
<int_16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <vga_test@plt>
lea    0xece(%rip),%rdi
mov    $0xa,%esi
call   1040 <print@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_16>:
push   %rax
xor    %eax,%eax
call   1030 <vga_test@plt>
lea    0xed1(%rip),%rdi
mov    $0xa,%esi
pop    %rax
jmp    1040 <print@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"inter 0x10 called\00"
define void @int_16() {
%1 = call i32 (...) @vga_test()
%2 = call i32 @print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"inter 0x10 called\00"
define void @int_16() {
%1 = tail call i32 (...) @vga_test()
%2 = tail call i32 @print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void repChar(char ch, int num) {
  int i;
  for (i = 0; i < num; i++) {
    printf("%c", ch);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<repChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1154 <repChar+0x44>
movsbl -0x1(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <repChar+0x18>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repChar>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    112c <repChar+0x1c>
mov    %esi,%ebx
movsbl %dil,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <repChar+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @repChar(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @repChar(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sext i8 %0 to i32
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %9, %6 ]
%8 = tail call i32 @putchar(i32 %5)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %1
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_memcpy(void *, void *, size_t);
int ft_strlen(char const *);
scalar_t__ malloc(size_t);
char *ft_strdup(const char *s1) {
  char *str;
  size_t size;
  size = ft_strlen(s1) + 0x01;
  if ((str = (char *)malloc(size * sizeof(*str))) == NULL)
    return (NULL);
  (void)ft_memcpy((void *)str, (void *)s1, size);
  return (str);
}


x86 assembly (clang, -O0):
<ft_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ft_strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
shl    $0x0,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1176 <ft_strdup+0x46>
movq   $0x0,-0x8(%rbp)
jmp    118f <ft_strdup+0x5f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <ft_memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <ft_strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     1163 <ft_strdup+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <ft_memcpy@plt>
jmp    1165 <ft_strdup+0x35>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @ft_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @ft_strlen(i8* %6)
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = mul i64 %10, 1
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %1
store i8* null, i8** %2
br label %22
16: ; preds = %1
%17 = load i8*, i8** %4
%18 = load i8*, i8** %3
%19 = load i64, i64* %5
%20 = call i32 @ft_memcpy(i8* %17, i8* %18, i64 %19)
%21 = load i8*, i8** %4
store i8* %21, i8** %2
br label %22
22: ; preds = %16, %15
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
define i8* @ft_strdup(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i64 @malloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i64 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @ft_memcpy(i8* %6, i8* %0, i64 %4)
br label %10
10: ; preds = %1, %8
%11 = phi i8* [ %6, %8 ], [ null, %1 ]
ret i8* %11
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_join(int /*<<< orphan*/, int /*<<< orphan*/ *);
void thread_wait(void *thread) { pthread_join((pthread_t)thread, NULL); }


x86 assembly (clang, -O0):
<thread_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_join@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_wait>:
xor    %esi,%esi
jmp    1030 <pthread_join@plt>

LLVM IR (-O0):
define void @thread_wait(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @pthread_join(i32 %4, i32* null)
ret void
}

LLVM IR (-O2):
define void @thread_wait(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @pthread_join(i32 %3, i32* null)
ret void
}
/* Variables and functions */
char *strrchr(const char *str, int c) { return NULL; }


x86 assembly (clang, -O0):
<strrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @strrchr(i8* nocapture readnone %0, i32 %1) {
ret i8* null
}
int test_00(int x, int y) {
  if (y)
    ++x;
  return x;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111d <test_00+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,%eax
cmp    $0x1,%esi
sbb    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @test_00(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
br label %10
10: ; preds = %7, %2
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_00(i32 %0, i32 %1) {
%3 = icmp ne i32 %1, 0
%4 = zext i1 %3 to i32
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int fib(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("Fibonacci of 4 is %d", fib(4));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [21 x i8] c"Fibonacci of 4 is %d\00"
define i32 @main() {
%1 = tail call i32 @fib(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ htole64(int /*<<< orphan*/);
void writeq(uint64_t v, void *a) {
  uint64_t *p = a;
  *p = htole64(v);
}


x86 assembly (clang, -O0):
<writeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <htole64@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeq>:
push   %rbx
mov    %rsi,%rbx
call   1030 <htole64@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @writeq(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %3
%9 = call i32 @htole64(i32 %8)
%10 = load i32*, i32** %5
store i32 %9, i32* %10
ret void
}

LLVM IR (-O2):
define void @writeq(i32 %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i32*
%4 = tail call i32 @htole64(i32 %0)
store i32 %4, i32* %3
ret void
}
double doublemod(double a, double b) {
  int i;
  double value;
  i = (int)(a / b);
  value = a - i * b;
  return value;
}


x86 assembly (clang, -O0):
<doublemod>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<doublemod>:
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @doublemod(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fdiv double %7, %8
%10 = fptosi double %9 to i32
store i32 %10, i32* %5
%11 = load double, double* %3
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = load double, double* %4
%15 = fneg double %13
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double %11)
store double %16, double* %6
%17 = load double, double* %6
ret double %17
}

LLVM IR (-O2):
define double @doublemod(double %0, double %1) {
%3 = fdiv double %0, %1
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %6, double %1, double %0)
ret double %7
}
/* Type definitions */
struct yaffs_dev {
  int dummy;
};

/* Variables and functions */
int yaffsfs_bg_gc_common(struct yaffs_dev *, int /*<<< orphan*/, int);
int yaffs_do_background_gc_reldev(struct yaffs_dev *dev, int urgency) {
  return yaffsfs_bg_gc_common(dev, (0), urgency);
}


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

x86 assembly (clang, -O2):
<yaffs_do_background_gc_reldev>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <yaffsfs_bg_gc_common@plt>

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

LLVM IR (-O2):
%struct.yaffs_dev = type { i32 }
define i32 @yaffs_do_background_gc_reldev(%struct.yaffs_dev* %0, i32 %1) {
%3 = tail call i32 @yaffsfs_bg_gc_common(%struct.yaffs_dev* %0, i32 0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int get_returnvalue();
int some_func() { return get_returnvalue(); }


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

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

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

LLVM IR (-O2):
define i32 @some_func() {
%1 = tail call i32 (...) @get_returnvalue()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
unsigned int logic_decimal_is_positive(unsigned short to_compare,
                                       char *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (to_compare > 0);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<logic_decimal_is_positive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <logic_decimal_is_positive+0x3a>
movl   $0x2,-0x14(%rbp)
jmp    1161 <logic_decimal_is_positive+0x51>
movzwl -0x2(%rbp),%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logic_decimal_is_positive>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     112f <logic_decimal_is_positive+0x1f>
test   %bp,%bp
setne  (%rbx)
xor    %eax,%eax
jmp    1134 <logic_decimal_is_positive+0x24>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @logic_decimal_is_positive(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i32
store i16 %0, i16* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @assert(i8* %6)
store i32 0, i32* %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 2, i32* %5
br label %18
11: ; preds = %2
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = icmp sgt i32 %13, 0
%15 = zext i1 %14 to i32
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
store i8 %16, i8* %17
br label %18
18: ; preds = %11, %10
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @logic_decimal_is_positive(i16 zeroext %0, i8* %1) {
%3 = tail call i32 @assert(i8* %1)
%4 = icmp eq i8* %1, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = icmp ne i16 %0, 0
%7 = zext i1 %6 to i8
store i8 %7, i8* %1
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ 2, %2 ]
ret i32 %9
}
void DebugP_log0(const char *format) {}


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

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

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

LLVM IR (-O2):
define void @DebugP_log0(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ hexprint(int, int *);
int main(void) {
  uint8_t hextest[] = {0x01, 0x02, 0x03};
  hexprint(3, hextest);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rsi
mov    $0x3,%edi
call   1030 <hexprint@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xeee(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xedb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x3,%edi
call   1030 <hexprint@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.hextest = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @hexprint(i32 3, i32* %3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.hextest = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @hexprint(i32 3, i32* %3)
ret i32 0
}
void test_31(unsigned i) {
  int j, k;
  j = i < 100 ? i : 100;
  k = i < 100 ? 100 : i;
}


x86 assembly (clang, -O0):
<test_31>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jae    111c <test_31+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1129 <test_31+0x29>
mov    $0x64,%eax
mov    %eax,-0x10(%rbp)
jmp    1129 <test_31+0x29>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x64,-0x4(%rbp)
jae    1146 <test_31+0x46>
mov    $0x64,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <test_31+0x4c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_31(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp ult i32 %5, 100
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* %2
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %7
%11 = phi i32 [ %8, %7 ], [ 100, %9 ]
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = icmp ult i32 %12, 100
br i1 %13, label %14, label %15
14: ; preds = %10
br label %17
15: ; preds = %10
%16 = load i32, i32* %2
br label %17
17: ; preds = %15, %14
%18 = phi i32 [ 100, %14 ], [ %16, %15 ]
store i32 %18, i32* %4
ret void
}

LLVM IR (-O2):
define void @test_31(i32 %0) {
ret void
}
char *my_strcpy_end(register char *dst, register char const *src) {
  while ((*dst++ = *src++) != '\0')
    ;
  return dst - 1;
}


x86 assembly (clang, -O0):
<my_strcpy_end>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <my_strcpy_end+0x3f>
jmp    110c <my_strcpy_end+0xc>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcpy_end>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,0x1(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <my_strcpy_end+0x10>
ret

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

LLVM IR (-O2):
define i8* @my_strcpy_end(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %4
}
int ret(int a) {
  if (a == 2)
    return 1;
  if (a == 3)
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<ret>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    111d <ret+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    113a <ret+0x3a>
cmpl   $0x3,-0x8(%rbp)
jne    1133 <ret+0x33>
movl   $0x2,-0x4(%rbp)
jmp    113a <ret+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ret>:
xor    %ecx,%ecx
cmp    $0x3,%edi
sete   %cl
add    %ecx,%ecx
cmp    $0x2,%edi
mov    $0x1,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ret(i32 %0) {
%2 = icmp eq i32 %0, 3
%3 = select i1 %2, i32 2, i32 0
%4 = icmp eq i32 %0, 2
%5 = select i1 %4, i32 1, i32 %3
ret i32 %5
}
unsigned short func16(unsigned short Dummy) { return Dummy; }


x86 assembly (clang, -O0):
<func16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @func16(i16 returned zeroext %0) {
ret i16 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void msg_error_theres_no_garbage() {
  printf("Error: there's no garbage to clean up.\n");
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"Error: there's no garbage to clean up.\0A\00"
define void @msg_error_theres_no_garbage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"Error: there's no garbage to clean up.\00"
define void @msg_error_theres_no_garbage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void get_time(struct timespec *time) { clock_gettime(CLOCK_REALTIME, time); }


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
jmp    1030 <clock_gettime@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define void @get_time(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_REALTIME
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i32 @clock_gettime(i32 %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define void @get_time(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_REALTIME
%3 = tail call i32 @clock_gettime(i32 %2, %struct.timespec* %0)
ret void
}
double step_to_approximate_frame(int frames, int steps, int step) {
  return (step + 0.5) / steps * frames;
}


x86 assembly (clang, -O0):
<step_to_approximate_frame>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xee6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<step_to_approximate_frame>:
cvtsi2sd %edx,%xmm1
addsd  0xef4(%rip),%xmm1
cvtsi2sd %esi,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @step_to_approximate_frame(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fadd double %8, 5.000000e-01
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = fmul double %12, %14
ret double %15
}

LLVM IR (-O2):
define double @step_to_approximate_frame(i32 %0, i32 %1, i32 %2) {
%4 = sitofp i32 %2 to double
%5 = fadd double %4, 5.000000e-01
%6 = sitofp i32 %1 to double
%7 = fdiv double %5, %6
%8 = sitofp i32 %0 to double
%9 = fmul double %7, %8
ret double %9
}
void window_ride_list_emptysub() {}


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

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

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

LLVM IR (-O2):
define void @window_ride_list_emptysub() {
ret void
}
int g(struct { int b[1]; } c) { return c.b[0]; }


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

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

LLVM IR (-O0):
%struct.anon = type { [1 x i32] }
define i32 @g(i32 %0) {
%2 = alloca %struct.anon
%3 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%4 = bitcast [1 x i32]* %3 to i32*
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @g(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int **calloc(int, int);
int /*<<< orphan*/ foo(int, int, int **);
int /*<<< orphan*/ free(int **);
int main(int argc, char *argv[]) {
  int(*k)[10] = calloc(10 * 10, sizeof(*k));
  foo(10, 10, k);
  free(k);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x64,%edi
mov    $0x28,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    $0xa,%esi
mov    %esi,%edi
call   1050 <foo@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
mov    $0x28,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %rax,%rdx
call   1050 <foo@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32** @calloc(i32 100, i32 40)
%8 = bitcast i32** %7 to [10 x i32]*
store [10 x i32]* %8, [10 x i32]** %6
%9 = load [10 x i32]*, [10 x i32]** %6
%10 = bitcast [10 x i32]* %9 to i32**
%11 = call i32 @foo(i32 10, i32 10, i32** %10)
%12 = load [10 x i32]*, [10 x i32]** %6
%13 = bitcast [10 x i32]* %12 to i32**
%14 = call i32 @free(i32** %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32** @calloc(i32 100, i32 40)
%4 = tail call i32 @foo(i32 10, i32 10, i32** %3)
%5 = tail call i32 @free(i32** %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ReadG();
int main() {
  ReadG();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @ReadG()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ReadG()
ret i32 0
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  char *my_title = malloc(strlen("FOO") + 1);
  strcpy(my_title, "FOO");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"FOO\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = add nsw i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"FOO\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%4 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int input() {
  int n;
  printf("Enter positive integer to check:\n");
  scanf("%d", &n);
  return n;
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Enter positive integer to check:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @input() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [33 x i8] c"Enter positive integer to check:\00"
define i32 @input() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
void test(void) { return; }


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

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

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

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

/* Variables and functions */
struct student *allocate();
int /*<<< orphan*/ deallocate(struct student *);
int /*<<< orphan*/ generate(struct student *);
int /*<<< orphan*/ output(struct student *);
int /*<<< orphan*/ summary(struct student *);
int main() {
  struct student *stud = 0;
  stud = allocate();
  generate(stud);
  output(stud);
  summary(stud);
  deallocate(stud);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1060 <allocate@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <generate@plt>
mov    -0x10(%rbp),%rdi
call   1030 <output@plt>
mov    -0x10(%rbp),%rdi
call   1050 <summary@plt>
mov    -0x10(%rbp),%rdi
call   1040 <deallocate@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <allocate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <generate@plt>
mov    %rbx,%rdi
call   1030 <output@plt>
mov    %rbx,%rdi
call   1050 <summary@plt>
mov    %rbx,%rdi
call   1040 <deallocate@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.student = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.student*
store i32 0, i32* %1
store %struct.student* null, %struct.student** %2
%3 = call %struct.student* (...) @allocate()
store %struct.student* %3, %struct.student** %2
%4 = load %struct.student*, %struct.student** %2
%5 = call i32 @generate(%struct.student* %4)
%6 = load %struct.student*, %struct.student** %2
%7 = call i32 @output(%struct.student* %6)
%8 = load %struct.student*, %struct.student** %2
%9 = call i32 @summary(%struct.student* %8)
%10 = load %struct.student*, %struct.student** %2
%11 = call i32 @deallocate(%struct.student* %10)
ret i32 0
}

LLVM IR (-O2):
%struct.student = type { i32 }
define i32 @main() {
%1 = tail call %struct.student* (...) @allocate()
%2 = tail call i32 @generate(%struct.student* %1)
%3 = tail call i32 @output(%struct.student* %1)
%4 = tail call i32 @summary(%struct.student* %1)
%5 = tail call i32 @deallocate(%struct.student* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ my_function();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Main function.\n");
  my_function();
  printf("Back in function main.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <my_function@plt>
lea    0xec7(%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   1030 <puts@plt>
xor    %eax,%eax
call   1040 <my_function@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [15 x i8] c"Main function.\00"
@str.2 = [23 x i8] c"Back in function main.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @my_function()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
int main(void) {
  _Bool flag = 0;
  if (!flag) {
    printf("yes,我是flag\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
testb  $0x1,-0x5(%rbp)
jne    113b <main+0x2b>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"yes,\E6\88\91\E6\98\AFflag\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
%3 = load i8, i8* %2
%4 = trunc i8 %3 to i1
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"yes,\E6\88\91\E6\98\AFflag\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Write_LCD(int, char *, int);
int /*<<< orphan*/ usleep(int);
void Clear_Screen(int fd) {
  char cmd[] = {254, 88, 253};
  Write_LCD(fd, cmd, 3);
  usleep(20000);
}


x86 assembly (clang, -O0):
<Clear_Screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xec6(%rip),%al
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x7(%rbp),%rsi
mov    $0x3,%edx
call   1030 <Write_LCD@plt>
mov    $0x4e20,%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Clear_Screen>:
push   %rax
movb   $0xfd,0x6(%rsp)
movw   $0x58fe,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x3,%edx
call   1030 <Write_LCD@plt>
mov    $0x4e20,%edi
call   1040 <usleep@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.Clear_Screen.cmd = [3 x i8] c"\FEX\FD"
define void @Clear_Screen(i32 %0) {
%2 = alloca i32
%3 = alloca [3 x i8]
store i32 %0, i32* %2
%4 = bitcast [3 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%7 = call i32 @Write_LCD(i32 %5, i8* %6, i32 3)
%8 = call i32 @usleep(i32 20000)
ret void
}

LLVM IR (-O2):
@__const.Clear_Screen.cmd = [3 x i8] c"\FEX\FD"
define void @Clear_Screen(i32 %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = call i32 @Write_LCD(i32 %0, i8* %3, i32 3)
%5 = call i32 @usleep(i32 20000)
ret void
}